Hey all,

unless you've been living under the rock for the last year, you've
probably heard of Moose. You know, the new red-hot object oriented framework
for Perl that kind of gives you some object-oriented conveniences that
will be available with Perl6, just with Perl5.

Now, it's long bothering me that we use macros like

    DEBUG "Waah!"

and pollute the namespace (upon request, not by default, as I'd like to
mention in our defense), but wouldn't it be nice to add Log4perl to
a class, not by inheritence, but via some "aspect" or "role"?

Well, wait no longer. "MooseX::Log::Log4perl" is here, which lets you do
stuff like

    package Ferrari;
    use Moose;
    with 'MooseX::Log::Log4perl';

    sub start {
        my ($self) = @_;

        $self->log->debug("Starting up!");
    }

hence adding a log() method to any class that needs logging, which gives
you a logger, which lets you run all of Log4perl's awesomeness you've
been taking for granted.

And, that's not all: Anonymous sources (cough!) have suggested that
"easy" shortcuts like log_debug() be added, which Roland Lammel,
who wrote this masterpiece, promptly did:

    package Ferrari;
    use Moose;
    with 'MooseX::Log::Log4perl::Easy';
    sub foo {
        my ($self) = @_;

        $self->log_debug("Starting up!");
    }

Isn't this great? I suggest you try it out (along with Moose, it's
really cool stuff) and rate it on

    http://cpanratings.perl.org/rate/?distribution=MooseX-Log-Log4perl

if you like it.

Have fun with Moose!

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to