Sha256: 021d4f8146c7e7e5b0886e4a56d56e98db1eebc403465a124fcc908fe19b4121
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
module Logatron class BasicScopedLogger include Logatron::Formatting def initialize(logger) @logger = logger @logs = { DEBUG => [], INFO => [], WARN => [], ERROR => [], CRITICAL => [], FATAL => [] } end def info(msg) write(format_log(msg: msg, severity: INFO), INFO) end def warn(msg) write(format_log(msg: msg, severity: WARN), WARN) end def debug(msg) write(format_log(msg: msg, severity: DEBUG), DEBUG) end def error(msg) write(format_log(msg: msg, severity: ERROR), ERROR) end def critical(msg) write(format_log(msg: msg, severity: CRITICAL), CRITICAL) end def fatal(msg) write(format_log(msg: msg, severity: FATAL), FATAL) end def write(string, severity=INFO) @logs[severity].push string end def flush Logatron.configuration.loggable_levels.each do |key| @logs[key].each do |item| @logger.write(item,Logatron::BasicLogger::MAP[key]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logatron-0.1.2 | lib/logatron/basic_scoped_logger.rb |
logatron-0.1.1 | lib/logatron/basic_scoped_logger.rb |