On Fri, 13 Jul 2007, Mesdaq, Ali wrote:

> The usual order that things are used in my case I write some
> functionality in a module and I might call another module which calls
> another and I will write a script that interfaces with the first
> module. Ideally I wish I could have shortcut calls like in the easy
> mode to save the extra typing of $this->{logger}->.  Shortcuts in
> typing make log::trace appealing but it can't compare in
> functionality.

I think what you need is already there: Just use :easy mode.

In a package, if you write

    package Foo;
    use Log::Log4perl qw(:easy);

then Log4perl will do two things when the module gets loaded:

1) Create a 'stealth logger' for the package
2) Introduce TRACE/DEBUG/INFO/WARN ... macros so that you don't
   have to run get_logger() to log something.

The macros will use the 'stealth logger', so they don't have to call
get_logger() internally (explained in the main Log::Log4perl manpage).

Easy mode is not only for simple scripts. It usually runs even faster than
regular mode. I'm using it almost exclusively in everything I write,
easy or complex.

> I have to say log4perl is a nice piece of work. You can appreciate it
> so much more after you spend some time writing your own logging module
> and resolving annoying issues then you see a super logging module like
> this.

Thanks for the note, I appreciate it!

-- Mike

Mike Schilli
[EMAIL PROTECTED]

>
> Thanks,
> ------------------------------------------
> Ali Mesdaq
> Security Researcher II
> Websense Security Labs
> http://www.WebsenseSecurityLabs.com
> ------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> log4perl-devel mailing list
> log4perl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to