Spyt
Simplify your logging
Presentation
This library provides a simple logger for any kind of application.
Installation
Gemfile
gem 'spyt'
Terminal
gem install -V spyt
Usage
Simply extend anything (module, class or whatever) with the Spyt::Loggable module. This will provide a log method which can be used as follows:
module Foo
include Spyt::Loggable
def foo
log.debug 'Debug Info...'
log.info 'Hello World!'
log.error 'This is an error message'
end
end
Configuration
Configuration of the Logger can be modified by playing with the Spyt::CONFIG object. The following options can be modified:
- :out - Output stream on which to produce logs (default: $stdout)
- :lvl - Current log level (default: :info)
# Dumping all the logs to a simple string:
s = ''
Spyt::CONFIG[:out] = s
# Changing the log level at runtime:
Spyt::CONFIG[:lvl] = :debug
Levels
Three levels are available:
- debug
- info
- error
License
The gem is available as open source under the terms of the MIT License.