Browse Source

Improving the logging capabilities

dev
Andy Meneely 12 years ago
parent
commit
82ff08041e
  1. 19
      lib/squib.rb

19
lib/squib.rb

@ -9,10 +9,23 @@ require 'squib/card'
module Squib module Squib
# :nodoc: # Access the internal logger that Squib uses. By default, Squib configure the logger to the WARN level
# @api private # Use this to suppress or increase output levels.
# @example
# Squib.logger.level = Logger::DEBUG #show waaaay more information than you probably need, unless you're a dev
# Squib.logger.level = Logger::ERROR #basically turns it off
#
# @return [Logger] the ruby logger
# @api public
def logger def logger
@logger ||= Logger.new(STDOUT) if @logger.nil?
@logger = Logger.new(STDOUT);
@logger.level = Logger::WARN;
@logger.formatter = proc do |severity, datetime, progname, msg|
"#{severity} #{progname}: #{msg}"
end
end
@logger
end end
module_function :logger module_function :logger

Loading…
Cancel
Save