Sha256: 4199775f1f59182866f4633eadcfd1538075f14e2f676f170cc18df37774ff8f

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

module Bluepill
  class Logger
    def initialize(logger = nil, prefix = nil)
      @logger = logger || Syslog.open('bluepill', Syslog::LOG_PID | Syslog::LOG_CONS, Syslog::LOG_LOCAL6)
      @prefix = prefix
    end
    
    [:emerg, :alert, :crit, :err, :warning, :notice, :info, :debug].each do |method|
      eval <<-END
        def #{method}(*args)
          with_prefix = args.collect {|s| "\#{@prefix}\#{s}" }
          @logger.#{method}(*with_prefix)
        end
      END
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bluepill-0.0.1 lib/bluepill/logger.rb