123456789_123456789_123456789_123456789_123456789_

Class: Syslog::Logger::Formatter

Relationships & Source Files
Inherits: Object
Defined in: ext/syslog/lib/syslog/logger.rb

Overview

Default formatter for log messages.

Instance Method Summary

Instance Method Details

#call(severity, time, progname, msg)

[ GitHub ]

  
# File 'ext/syslog/lib/syslog/logger.rb', line 51

def call severity, time, progname, msg
  clean msg
end

#clean(message) (private)

Clean up messages so they're nice and pretty.

[ GitHub ]

  
# File 'ext/syslog/lib/syslog/logger.rb', line 60

def clean message
  message = message.to_s.strip
  message.gsub!(/\e\[[0-9;]*m/, '') # remove useless ansi color codes
  return message
end