From: Mathieu L. <mrd...@ya...> - 2002-09-24 04:05:31
|
--- msc...@ao... wrote: > Funny, a couple of weeks ago I had exactly that in there. > However, there was some resistance on log4perl-devel > (Kevin!!!:) arguing that we need to educate people to > explicitely state the category (which could be very > different from the package name BTW). Hum. Sure. Programmers tend to be lazy, if they have to go through this trouble to write logging calls, you end up with no logging... And then, what do you turn on to debug your system at runtime? You still have the option of changing the category name. Maybe you could do it at the use level: use Log::Log4perl::EZ +MyOwnCategory; (Note that I'm not positive how to implement this, I'm just throwing the suggestion). > my $logger = get_logger("Blah::Poo"); > $logger->debug("Something happened!!!"); > # ... > $logger->debug("Something else!!!"); > > which just obtains the logger instance once. Which could > have a significant impact if there are 20 debug > statements within one function. A quick glance at the code, and me think one could cache the logger objects without trouble (unless they are much bigger than I think). So get_logger would become: sub get_logger() { ... my $category = $_[0]; return $loggers{$category} if exists $loggers{$category}; return $loggers{$category} = Log::Log4perl::Logger->get_logger($category); } What do you think? -Mathieu __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com |