Class: Trinidad::Logging::MessageFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/trinidad/logging.rb

Overview

A message formatter only prints the log message (and the thrown value).

Constant Summary collapse

WEB_APP_LOGGER_NAME =
/org\.apache\.catalina\.core\.ContainerBase.*?\[(\/.*?)\]$/

Instance Method Summary collapse

Instance Method Details

#format(record) ⇒ Object

:nodoc



221
222
223
224
225
226
227
228
229
230
231
# File 'lib/trinidad/logging.rb', line 221

def format(record)
  msg = formatMessage(record)
  msg << formatThrown(record).to_s
  # since we're going to print Rails.logger logs and they tend
  # to already have the ending "\n" handle such cases nicely :
  if web_app_path(record.getLoggerName)
    (lns = LINE_SEP) == msg[-1, 1] ? msg : msg << lns
  else
    msg << LINE_SEP
  end
end