Class: ThreadFormatter
- Inherits:
-
Object
- Object
- ThreadFormatter
- Defined in:
- lib/common/thread_formatter.rb
Overview
Copyright © 2009-2012 VMware, Inc.
Constant Summary collapse
- FORMAT =
"%s, [%s#%d] [%s] %5s -- %s: %s\n"
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 ⇒ ThreadFormatter
constructor
A new instance of ThreadFormatter.
Constructor Details
#initialize ⇒ ThreadFormatter
Returns a new instance of ThreadFormatter.
8 9 10 |
# File 'lib/common/thread_formatter.rb', line 8 def initialize @datetime_format = nil end |
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
6 7 8 |
# File 'lib/common/thread_formatter.rb', line 6 def datetime_format @datetime_format end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
12 13 14 15 16 |
# File 'lib/common/thread_formatter.rb', line 12 def call(severity, time, progname, msg) thread_name = Thread.current[:name] || "0x#{Thread.current.object_id.to_s(16)}" FORMAT % [severity[0..0], format_datetime(time), $$, thread_name, severity, progname, msg2str(msg)] end |