Class: Pigeon::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/pigeon/logger.rb

Instance Method Summary collapse

Instance Method Details

#format_message(severity, datetime, progname, msg) ⇒ Object

Over-rides the default log format.



12
13
14
# File 'lib/pigeon/logger.rb', line 12

def format_message(severity, datetime, progname, msg)
  "[%s %6d] %s\n" % [ datetime.strftime("%Y-%m-%d %H:%M:%S"), thread_id, msg ]
end

#thread_idObject

Returns a sequential thread identifier which is human readable and much more concise than internal numbering system used.



6
7
8
9
# File 'lib/pigeon/logger.rb', line 6

def thread_id
  @threads ||= { }
  @threads[Thread.current.object_id] ||= @threads.length
end