http://www.perlmonks.org?node_id=531108


in reply to RFC: A simple and badly-named logging module

My first impression is that it's a nice little utility!

My second impression is that I'd like to see something a little more like a unix syslog instead of the 0, 1, 2 constants. E.g. set a destination for all events of a given level or better, choose different files for different types.

use Log ( trace => "everything.log", info => "info_or_better.log", info => \STDERR, # also echo info or higher to STDERR )

I'm not so sure that's really the way I'd want it, but maybe it will give you some ideas.

Finally, I would definitely not use globals like $Log::filename or $Log::info. Consider storing these in a hash keyed on the caller's package. This will allow modular programs to use your module differently in different parts of the program.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.