Class: Logger
Instance Method Summary collapse
Instance Method Details
#format_message(severity, timestamp, progname, msg) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/m_logger.rb', line 29 def (severity, , progname, msg) # Check for characters at the start of the message string indicating special formatting # Make the typical case as efficient as possible if not msg[0..1] == '$@' pid = (defined?(ENABLE_PIDS_IN_LOGS) and ENABLE_PIDS_IN_LOGS) ? "(#{$$}) " : '' return "#{pid}[#{severity}]\t#{}\t#{msg}\n" end format = msg[2..2] msg = msg[3..-1] # Original format if format == 'O' return "#{}\t[#{severity}]\t#{msg}\n" elsif format == 'S' return "#{msg}\n" end end |