Class: Gom::Logger
- Inherits:
-
Logger
- Object
- Logger
- Gom::Logger
- Defined in:
- lib/gom/logger.rb
Constant Summary collapse
- Levels =
Gom::Log.level = Gom::Attribute.value(“/gom/log:level”, ::Logger::INFO)
{ "debug" => ::Logger::DEBUG, "info" => ::Logger::INFO, "warn" => ::Logger::WARN, "error" => ::Logger::ERROR, "fatal" => ::Logger::FATAL, }
- DEFAULT_OUT =
output defaults to STDOUT for rails test and non-rails apps, to a logfile otherwise
begin if (RAILS_ROOT.nil? rescue true) STDOUT else if 'test' === RAILS_ENV STDOUT else "#{RAILS_ROOT}/log/gom-#{RAILS_ENV}.log" end end end
Instance Method Summary collapse
-
#ex(e, msg = nil, level = :error) ⇒ Object
experimental convenience function:.
-
#format_message(severity, timestamp, progname, msg) ⇒ Object
this is to de-patch the rails formatting patch..
-
#initialize(out = DEFAULT_OUT) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(out = DEFAULT_OUT) ⇒ Logger
Returns a new instance of Logger.
32 33 34 |
# File 'lib/gom/logger.rb', line 32 def initialize out = DEFAULT_OUT super out end |
Instance Method Details
#ex(e, msg = nil, level = :error) ⇒ Object
56 57 58 59 |
# File 'lib/gom/logger.rb', line 56 def ex e, msg = nil, level = :error send level, "#{e}: #{(msg || e)}" debug "#{e} -- callstack: #{msg}\n\t#{e.backtrace.join "\n\t"}" end |
#format_message(severity, timestamp, progname, msg) ⇒ Object
this is to de-patch the rails formatting patch..
37 38 39 |
# File 'lib/gom/logger.rb', line 37 def (severity, , progname, msg) "#{.strftime '%Y-%m-%d %H:%M:%S'} #{severity[0,1]} #{msg}\n" end |