Ruby logging library that provides the ability to add class/module specific filters
View the Project on GitHub gshutler/hatchet
Hosted on GitHub Pages — Theme by orderedlist
Hatchet is a logging framework written from the ground up in Ruby. It has been inspired by the likes of log4j and slf4j but is not a port of either of them.
Hatchet aims to integrate seamlessly with your Ruby projects and provide a single logging interface that can pass on messages to any backend you want to use.
Hatchet has specific hooks for Rails and Sinatra though it is suitable for use in any Ruby project. Please select the installation guide that most suits your scenario below:
To use the logger you must add it to your classes as a mixin or use it to extend
your modules. Then you can call the logger through the methods log
and
logger
. They are aliases for the same method to ease migration.
The logger has all the core methods you are used to from the standard logger for
logging messages taking either a String
or a lazily-evaluated block:
debug
info
warn
error
fatal
It is recommended you use the block version as it avoids needless string
interpolation when possible. However, if you are providing an error it reads
better to use the String
version, passing the error as a second parameter:
An error can be passed to any level logging call.
It also has all the methods for checking whether logging is active at a given level:
debug?
info?
warn?
error?
fatal?
The level of logging can be controlled down to the class level and each message can be logged to several locations. See the configuration guide for more details.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)All pull requests should come complete with tests when appropriate and should
follow the existing style which is best described in
Github’s Ruby style guide. Bonus internet
points are provided if you submit a pull request for the gh-pages
branch too.