NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
I'm not a fan of the syntax... (Score:1)
Personally I'd have done the name'ology differently (although tbh I'm not sure what I'd have used instead).
Re: (Score:1)
What if I want to make an logger for a single object...
Re: (Score:1)
my $log = Log::Any->get_logger(category => '...');
and you would use this to create a lexically scoped logger or a logger contained in an object.
As far as the "Any" name - I agree, it isn't ideal, but I haven't been able to think of a better
Re: (Score:1)
That implies you are keeping inside Log::Any a hash of some sort with the class as the key and an object or log class as the value. That's what I meant by the class-level storage.
As for
Re:I'm not a fan of the syntax... (Score:1)
> CPAN search for "Abstract" and have a read through some of the modules there, there is a
> precent for this general type of thing.
Thanks, I like that name much better! "Any" has always seemed rather...indecisive. I'm going to retroactively change this in the journal entry.
> I don't mean for $log, I mean for "category => '...'.
>
> That implies you are keeping inside Log::Any a hash of some sort with the class as the key
> and an object or log class as the value. That's what I meant by the class-level storage.
So the question is whether get_logger() automatically memoizes based on the category name, or whether this is the responsibility of the underlying logging package and/or the code registered in set_logger().
I had leaned towards memoizing, because most logging packages will not handle this for you (log4perl being the exception) and it seems like the expected behavior.
I wonder what the point would be of creating multiple Log::Abstract loggers with the same category anyway, given that category is the only data upon which the application has to decide what logging package and settings will be used. That is, given two calls
my $logger1 = Log::Abstract->get_logger("foo");
my $logger2 = Log::Abstract->get_logger("foo");
wouldn't these pretty much have to return the same logger, unless the routine passed to set_logger() was changing its behavior over time?
Remember that set_logger can be called more than once in an application to effectively change all existing abstract loggers. So there is little reason for the routine passed to set_logger() to be dynamic across anything other than category.
I hope that makes sense.
Jon
Reply to This
Parent