Class: Rearview::LogFormatter
- Inherits:
-
Object
- Object
- Rearview::LogFormatter
- Defined in:
- lib/rearview/log_formatter.rb
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 ⇒ LogFormatter
constructor
A new instance of LogFormatter.
Constructor Details
#initialize ⇒ LogFormatter
Returns a new instance of LogFormatter.
8 9 10 |
# File 'lib/rearview/log_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/rearview/log_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/rearview/log_formatter.rb', line 12 def call(severity, time, progname, msg) thread_name = java.lang.Thread.currentThread.getName default_name = ( progname.present? ? progname : "Rearview" ) Format % [severity[0..0],format_datetime(time),$$,thread_name,severity,default_name,msg2str(msg)] end |