Class: Cinch::Logger::FormattedLogger

Inherits:
Cinch::Logger show all
Defined in:
lib/cinch/logger/formatted_logger.rb

Overview

Version:

  • 2.0.0

Constant Summary collapse

COLORS =
{
  reset: "\e[0m",
  bold: "\e[1m",
  red: "\e[31m",
  green: "\e[32m",
  yellow: "\e[33m",
  blue: "\e[34m",
  black: "\e[30m",
  bg_white: "\e[47m"
}

Constants inherited from Cinch::Logger

LEVEL_ORDER

Instance Attribute Summary

Attributes inherited from Cinch::Logger

#level, #mutex, #output

Instance Method Summary collapse

Methods inherited from Cinch::Logger

#debug, #error, #fatal, #incoming, #info, #initialize, #log, #outgoing, #warn, #will_log?

Constructor Details

This class inherits a constructor from Cinch::Logger

Instance Method Details

#exception(e) ⇒ void

This method returns an undefined value.

Logs an exception.

Parameters:

  • e (Exception)

Since:

  • 2.0.0



22
23
24
25
26
# File 'lib/cinch/logger/formatted_logger.rb', line 22

def exception(e)
  lines = ["#{e.backtrace.first}: #{e.message} (#{e.class})"]
  lines.concat e.backtrace[1..].map { |s| "\t" + s }
  log(lines, :exception, :error)
end