On 9/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > So I guess what I'm saying is that the final thing that would stop me from > > using Log::Any "everywhere" (meaning also in performance-critical code) is > > the overhead for the common (production) case of logging being entirely > > disabled. How about providing all three methods of checking as part of the > > API? > > > > $log->debug(...) if $log->is_debug(); # method > > $log->debug(...) if Log::Any::is_debug(); # sub > > $log->debug(...) if $Log::Any::Is_Debug; # var > > Good point. The last two need to be tweaked so that we can assign > different logging levels and/or destinations to different loggers - > e.g. to turn on just Rose::DB debug logging without a flood from other > modules. (See log4perl). > > How about this: > > use Log::Abstract qw($log $log_is_debug); > > $log->debug(...) if $log_is_debug; > > which translates to something like > > use Log::Abstract; > my $log = Log::Abstract->get_logger > (category => __PACKAGE__, is_debug_flag => \my $log_is_debug); > > $log->debug(...) if $log_is_debug; > > Now $log_is_debug, like $log, is class/category specific. Note that > with either syntax, Log::Abstract is able to keep track of all the > $log_is_debug variables and update them at runtime when something > happens in the log framework to change log levels (e.g. log4perl > reloading configuration). Assuming log level changes happen > infrequently, this should yield good performance even when logging is > turned on.
So you're saying if export() finds '$log' in its arg list, it will create a $log variable in the calling package and initialize it to an object? I don't think I've ever seen that done, but I think I like that idea... though I'm inclined to think that passing \$LOG would be a bit more perlish.