Class: Sqreen::FormatterWithTid

Inherits:
Object
  • Object
show all
Defined in:
lib/sqreen/formatter_with_tid.rb

Overview

Ruby default formatter modified to display current thread_id

Constant Summary collapse

Format =

TODO: constant name

"%s, [%s#%d.%s] %5s -- %s: %s\n".freeze
DatetimeFormat =
'%Y-%m-%dT%H:%M:%S.%6N '.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatterWithTid

Returns a new instance of FormatterWithTid.



17
18
19
# File 'lib/sqreen/formatter_with_tid.rb', line 17

def initialize
  @datetime_format = nil
end

Instance Attribute Details

#datetime_formatObject

Returns the value of attribute datetime_format.



15
16
17
# File 'lib/sqreen/formatter_with_tid.rb', line 15

def datetime_format
  @datetime_format
end

Instance Method Details

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



21
22
23
24
25
26
27
28
# File 'lib/sqreen/formatter_with_tid.rb', line 21

def call(severity, time, progname, msg)
  format(
    Format,
    severity[0..0], format_datetime(time), $$,
    Thread.current.object_id.to_s(36),
    severity, progname, msg2str(msg),
  )
end