Class: Filum::LogFormatter

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/filum/log_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ LogFormatter

Returns a new instance of LogFormatter.



5
6
7
8
# File 'lib/filum/log_formatter.rb', line 5

def initialize(options = {})
  @context_id_length = options.fetch(:context_id_length, 6)
  @filename_length = options.fetch(:filename_length, 20)
end

Instance Method Details

#call(severity, timestamp, progname, msg) ⇒ Object



10
11
12
# File 'lib/filum/log_formatter.rb', line 10

def call(severity, timestamp, progname, msg)
  "#{timestamp} #{formatted_thread_id} [#{formatted_context_id}] #{severity.to_s.ljust(5)} | #{formatted_calling_file_and_line} | #{msg}\n"
end