I love MooseX::Role::Loggable
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...
- Supports logging to file, stdout, stderr
- Supports logging to syslog
- Supports prefixes (custom, per-method, etc.)
- Debug-level logging with baked-in "debug" attribute
- Uses Any::Moose, meaning it can work with Moose or Mouse
- Built for comfort, strength and flexibility
MooseX::Role::Loggable - try it!