Sha256: 99523d22bcfd7951d200faf2aeab967954ec83e5999918c8f94a49aa49e79216
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
module Gom # GOM default Logger instance Log = Gom::Logger.new # TODO: runtime configuration might move to config/initializers/... Log.level = ::Logger::DEBUG end __END__ Log = ::Logger.new case RAILS_ENV when "test" STDOUT else "#{RAILS_ROOT}/log/gom-#{RAILS_ENV}.log" end class << Log # this is to de-patch the rails formatting patch.. def format_message(severity, timestamp, progname, msg) "#{timestamp.to_formatted_s(:db)} #{severity.first} #{msg}\n" end # experimental convenience function: # # Log.ex e # # does actually do: # Log.error e # Log.debug "#{e.backtrace.join "\n\t"}" # # and: # Log.ex e, "some message here" # # stands for: # Log.error "some message here" # Log.debug "#{e.backtrace.join "\n\t"}" # def ex e, msg = nil, level = :error send level, (msg || e) debug "#{e} -- error was: #{msg}\n\t#{e.backtrace.join "\n\t"}" end end # TODO: runtime configuration might move to config/initializers/... Log.level = ::Logger::DEBUG end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gom-core-0.2.1 | lib/gom/log.rb |
gom-core-0.2.0 | lib/gom/log.rb |