$Header: /var/cvs/sources/Funlog/README,v 1.13 2004/12/22 00:19:59 gab Exp $ vim600: set textwidth=80: Log::Funlog - Log with fun! Gab korsani(removeme)@free(removeme).fr(removeagain) ,+---------------------------------- - - - - - ( | Description `+---------------------------------- - - - - - Easy to use and funny log module :P I tried to make it fast and convenient. That mean that there is as few as possible mandatory option when initializing the module (actually, there is only one :) and it is REALLY easy to use. No headache to choose wether or not put this option, and you don't screw your brain trying to understand what this bloody option do. All is simple. ,+---------------------------------- - - - - - ( | Features: `+---------------------------------- - - - - - - Log level (verbosity, as much as you want) - Logging to stderr or file (as you want) - Print stack of calling subs (if you want) - (Quite) customizable prefix - Quite fast - Fun included (if you want! ) Feel free to modify this module to your convenience. ,+---------------------------------- - - - - - ( | Install `+---------------------------------- - - - - - perl Makefile.PL make (make test) sudo make install Note: you can perl Makefile.PL INSTALLDIRS=vendor if you want to make the module not dependant of your perl version. I made a 'vendor' install by default, but it seems that not all perl distros can install as 'vendor'... ,+---------------------------------- - - - - - ( | Use `+---------------------------------- - - - - - Simple way: no header, log to stderr, no fun, just log :) If you have just one thing to remember, it is this form. use Log::Funlog; *Log=Log::Funlog->new( verbose => '3/5' #verbose 3 out of 5 ); Log(1,"plop"); #this will be printed Log(2,"plop"); #this too Log(3,"plop"); #this again Log(4,"plop"); #but not that, as 4 > 3 Log(5,"plop"); #neither that Log(6,"plop"); #neither that, even if 6 > 5 Complicated way (example): use Log::Funlog qw( error ); *Log=Log::Funlog->new( file => "zou.log", #name of the file verbose => '3/5', #verbose 3 out of 5 daemon => 1, #I am a daemon, so log to the file ("zou.log") header "%dd %pp %l[]l %s{}s ", #header format cosmetic => 'x', #crosses for the level fun => 10, #10% of fun (que je passe autour de moi) error_header => 'Groumpf... ', #Header for true errors caller => 1); #and I want the name of the sub that is logging sub sub_plop { $i=shift; Log($i%5,"plop",$i); } for(my $i=1;$i<100;$i++) { sub_plop($i); }