Class: DailyLogger::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/daily_logger/formatter.rb

Overview

Default formatter for log messages

Constant Summary collapse

Format =
"[%s]\t%s\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatter

Returns a new instance of Formatter.



8
9
10
# File 'lib/daily_logger/formatter.rb', line 8

def initialize
  @datetime_format = nil
end

Instance Attribute Details

#datetime_formatObject

Returns the value of attribute datetime_format.



6
7
8
# File 'lib/daily_logger/formatter.rb', line 6

def datetime_format
  @datetime_format
end

Instance Method Details

#call(time, msg, block_msg) ⇒ Object



12
13
14
# File 'lib/daily_logger/formatter.rb', line 12

def call(time, msg, block_msg)
  Format % [format_datetime(time), make_msg(msg, block_msg)]
end