Sha256: 3726de584cdca8acb85c2984f235d9ef0504f869e4b0b381fb721bf7e3776e9d
Contents?: true
Size: 946 Bytes
Versions: 5
Compression:
Stored size: 946 Bytes
Contents
require 'logger' module Logster class Logger < ::Logger LOGSTER_ENV = "logster_env".freeze attr_accessor :store def initialize(store) super(nil) @store = store end def chain(logger) @chained ||= [] @chained << logger end def add(severity, message, progname, &block) if severity < @level return true end if @chained i = 0 # micro optimise for logging while i < @chained.length # TODO double yielding blocks @chained[i].add(severity, message, progname, &block) i += 1 end end progname ||= @progname if message.nil? if block_given? message = yield else message = progname progname = @progname end end @store.report(severity, progname, message, { env: Thread.current[LOGSTER_ENV] }) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
logster-0.0.9 | lib/logster/logger.rb |
logster-0.0.8 | lib/logster/logger.rb |
logster-0.0.7 | lib/logster/logger.rb |
logster-0.0.6 | lib/logster/logger.rb |
logster-0.0.5 | lib/logster/logger.rb |