Class: Mack::Logging::ColorLayout

Inherits:
BasicLayout show all
Defined in:
lib/mack/boot/logging/color_layout.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Logging::Layout

#footer, #header, #initialize

Constructor Details

This class inherits a constructor from Logging::Layout

Instance Method Details

#format(event) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mack/boot/logging/color_layout.rb', line 6

def format(event)
  message = super(event)
  if message.match(/(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP)/)
    return Mack::Utils::Ansi::Color.wrap(configatron.mack.log.colors.db, message)
  else
    color = configatron.mack.log.colors.retrieve(event.level_name.downcase.to_sym, nil)
    if color
      return Mack::Utils::Ansi::Color.wrap(color, message)
    else
      return message
    end
  end
end