| Class | ANSI::Logger |
| In: |
lib/ansi/logger.rb
|
| Parent: | Logger |
Extended variation of Ruby‘s standard Logger library that supports color output.
log = ANSI::Logger.new
log.formatter do |severity, timestamp, progname, msg|
ANSI::Logger::SIMPLE_FORMAT % [severity, msg]
end
| SIMPLE_FORMAT | = | "%5s: %s\n" | Some available logging formats. | |
| DETAILED_FORMAT | = | "%s %5s: %s\n" |
Dictate the way in which this logger should format the messages it displays. This method requires a block. The block should return formatted strings given severity, timestamp, progname and msg.
logger = ANSI::Logger.new
logger.formatter do |severity, timestamp, progname, msg|
"#{progname}@#{timestamp} - #{severity}::#{msg}"
end