On Sat, 8 Sep 2007, Jonathan Swartz wrote:

> Did you see this in the posting?
>
>      As a convenient shorthand, you can use
>
>              package Foo;
>              use Log::Abstract qw($log);
>
>      to create the logger, which is equivalent to the first example
> except that $log is
>      (necessarily) a package-scoped rather than lexical variable.
>
> So this creates a logger for you with the category set to the current
> 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([EMAIL PROTECTED]);
>
> 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([EMAIL PROTECTED]));

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([EMAIL PROTECTED]) };

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.

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to