I love MooseX::Role::Loggable

I love Log::Dispatchouli. I really do. I does a lot of work so you don't have to, and that's usually the type of stuff rjbs does.

After using Log::Dispatchouli for two projects, I decided to refactor it. No point in having code duplicity, right? So I refactored it into a role and called that role MooseX::Role::Loggable. That code is obviously on CPAN and has been for quite a while.

Once you add MooseX::Role::Loggable to your app you can suddenly have logging, the way Log::Dispatchouli does it. How? You suddenly have a debug attribute, for example. You suddenly have a logger_ident and a logger_facility attributes that you can override (though they have default values, one is of your package name automatically). You can now call the log method, and the log_debug method that will log only if the debug flag is on.

It's so simple I've set up all applications at $work to use it.

Why you should use? Well...

  1. Supports logging to file, stdout, stderr
  2. Supports logging to syslog
  3. Supports prefixes (custom, per-method, etc.)
  4. Debug-level logging with baked-in "debug" attribute
  5. Uses Any::Moose, meaning it can work with Moose or Mouse
  6. Built for comfort, strength and flexibility

MooseX::Role::Loggable - try it!

2 Comments

Log::Dispatch is wonderful.

Log::Dispatchouli is awesome.

And now this MooseX::Role::Loggable... it's.. it's... I'm running out of superlatives, darnit. :-)

Something tells me there will be a migration of my own modules to that new level of epic niftiness. Thanks for sharing. :-)

Leave a comment

About Sawyer X

user-pic Gots to do the bloggingz