NNNNAAAAMMMMEEEE Logger - Debugging tool which outputs logging messages in a nifty format. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS · Print messages to both STDERR and a file: use Pat::Logger; $debug_file = '/tmp/foo.log'; eval { $logger = new Pat::Logger ( $debug_file ) }; die $@ if $@; $logger->debug_message ( "Logger will tell you the package, subroutine and line number" ); $logger->debug_message ( 'your debug message originated from' ); · Print to STDERR only: use Pat::Logger; eval { $logger = new_stdout Pat::Logger() }; die $@ if $@; $logger->debug_message ( "This line will go to STDERR only" ); $logger->separate; $logger->debug_message ( "This line is separated from the previous one" ); DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The Logger module is a nifty tool to organaize your debug messages. While writing your code you need a tool to output your debug messages. You want to see where the message originated from (which module, which subroutine and line number), so you can proceed directly to solving the matter, rather than search for it's location. Not only you want to see the messages on screen, you want to have them in a local file as well. Logger does just that. There are two working modes for Logger, each one has it's own constructor: (1) Debugging to STDERR+file. (2) Debugging to STDERR only. · _nn_ee_ww(((($$$$)))) This constructor expects a file name to output all message to. Upon success, a blessed hash reference will be returned. Upon failure the method dies, and $@ will hold the error message. · _nn_ee_ww____ss_tt_dd_oo_uu_tt_((_)) All debug messages will be sent to STDERR solemly. Upon success, a blessed hash reference will be returned. Upon failure the method dies, and $@ will hold the error message. · _dd_ee_bb_uu_gg____mm_ee_ss_ss_aa_gg_ee(((($$$$)))) This method takes one argument - the debug message you wish to log. Upon success - the method returns 1. Upon failre - the method returns 0. The Logger object does all the work behind the scenes: (1) Grab the package, subroutine name and line number which the message originated from. (2) Create a nice format with the parameters aforementioned. (3) Output it according to object type. · _ss_ee_pp_aa_rr_aa_tt_ee_((_)) You may wish to create visual separation between messages. When you invoke separate(), a line consistant of 152 x '-' will be outputed. This length is coherent with the length of the format. BBBBUUUUGGGGSSSS None at the moment. If you have any question or comment - pengas@cpan.org CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT Copyright 2001-2002, Pengas Nir This library is free software - you can redistribute it and/or modify it under the same terms as Perl itself. 2002-01-03 perl v5.6.1 1