Class: Sqreen::FormatterWithTid
- Inherits:
-
Object
- Object
- Sqreen::FormatterWithTid
- 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
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
Instance Method Summary collapse
- #call(severity, time, progname, msg) ⇒ Object
-
#initialize ⇒ FormatterWithTid
constructor
A new instance of FormatterWithTid.
Constructor Details
#initialize ⇒ FormatterWithTid
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_format ⇒ Object
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 |