module Hoodoo::Logger::FlattenerMixin
This mixin is used by custom logger subclasses and defines a single method, Hoodoo::Logger::FlattenerMixin#flatten
, which takes structured log data and turns it into a single line of output including ISO 8601 time and date in local server time zone (since that makes log analysis easier for humans working in non-UTC time zone regions).
Using this is of course entirely optional, but if you do use it, you will be ensuring consistent non-structured log output across any non-structured writers.
Public Instance Methods
flatten( log_level, component, code, data )
click to toggle source
Take the parameters from Hoodoo::Logger::WriterMixin#report
and return a single line string representing the “flattened” log data.
# File lib/hoodoo/logger/flattener_mixin.rb, line 31 def flatten( log_level, component, code, data ) "#{ log_level.to_s.upcase } [#{ Hoodoo::Utilities.standard_datetime( Time.now ) }] #{ component } - #{ code }: #{ data.inspect }" end