Sha256: 810d2bdb9152318fe3b4a352f434d815bda449ef0ad2c23bce43749310de48fe

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

module Zetto::Services

  class ZettoLogger < Logger
    include Singleton

    def initialize
      super(Rails.root.join('log/rrd.log'))
      self.formatter = formatter()
      self
    end

    # Optional, but good for prefixing timestamps automatically
    def formatter
      Proc.new { |severity, time, progname, msg|
        formatted_severity = sprintf("%-5s", severity.to_s)
        formatted_time = time.strftime("%Y-%m-%d %H:%M:%S")
        "[#{formatted_severity} #{formatted_time} #{$$}] #{msg.to_s.strip}\n"
      }
    end

    class << self
      delegate :error, :debug, :fatal, :info, :warn, :add, :log, :to => :instance
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zetto-2.2.0 lib/zetto/services/zetto_logger.rb