Class: AppLogger::Formatter::Json
- Inherits:
-
Object
- Object
- AppLogger::Formatter::Json
- Defined in:
- lib/app_logger/formatter/json.rb
Direct Known Subclasses
Constant Summary collapse
- FORMAT =
"%s\n"
Instance Method Summary collapse
- #call(severity, datetime, progname, message) ⇒ Object
-
#initialize(hostname = `hostname`.chomp) ⇒ Json
constructor
A new instance of Json.
Constructor Details
#initialize(hostname = `hostname`.chomp) ⇒ Json
Returns a new instance of Json.
8 9 10 |
# File 'lib/app_logger/formatter/json.rb', line 8 def initialize(hostname=`hostname`.chomp) @hostname = hostname end |
Instance Method Details
#call(severity, datetime, progname, message) ⇒ Object
12 13 14 15 |
# File 'lib/app_logger/formatter/json.rb', line 12 def call(severity, datetime, progname, ) msg = msg2hash() FORMAT % common_msg(severity, datetime, progname).merge(msg).to_json end |