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.
Great work, and can I have stealth loggers? (Score:1)
It is really unfortunate that important CPAN modules like LWP or Rose::DB don't have usable logging mechanisms in place. Once you're used to category-based logging it's hard to go back to these home-grown and less convenient solutions.
I think it's a great idea to promote standardized logging on CPAN and letting the user choose the actual implementation will definitely help to make strides towards that goal.
By the way, I don't agree that
Re: (Score:1)
> minimize dependencies, depending on Log4perl (for example) is a
> non-starter." The Log4perl core doesn't have dependencies other
> than perl's core modules.
Fair enough.
>
> One thing missing from your proposal is Log4perl's
> [sourceforge.net]. If you think about it, getting a logger and
> calling its method is a lot of typing, given that you just want
> to log something. That's why in Log4perl you can use
>
Re:Great work, and can I have stealth loggers? (Score:1)
> package, similar to easy mode. The syntax is pretty minimal.
Ah, gotcha. So you would call
$log->debug(...)
instead of
DEBUG "..."
which is probably acceptable in terms of additional key strokes
(although it might throw off novices).
> The problem I have with the DEBUG etc keywords is that they promote
>inefficient behavior. e.g.
>
> DEBUG "Current arguments: " . Dumper(\@_);
>
> will take the performance hit for Dumper() even when debug logging
> isn't turned on.
Sure, although I don't see how
$log->debug("Current arguments: " . Dumper(\@_));
is any different. By the way, in Log4perl you can pass a subroutine ref
to the method, which eliminates the problem:
DEBUG sub { "Current arguments: " . Dumper(\@_) };
Efficient, but ugly
While you're at it, here's my pipe dream: I want something like Dtrace,
where the logging framework zeroes out the opcodes that are currently
inactive, and the interpreter rushes through them at light speed with
practically no overhead.
Reply to This
Parent
Re: (Score:1)
Assertions were going to make that possible in 5.10.
Unfortunately they were recently removed from bleadperl. :-(