module CWLLogger
Constants
- VERSION
Public Class Methods
app_name()
click to toggle source
Returns the app name. Defaults to the value in ENV
# File lib/cwllogger.rb, line 12 def self.app_name @app_name || ENV["APP"] || "unset" end
app_name=(value)
click to toggle source
Sets the app name
# File lib/cwllogger.rb, line 7 def self.app_name=(value) @app_name = value end
log(event, args = {})
click to toggle source
Writes a new log message. Takes args, a hash of keys and values that should be written
# File lib/cwllogger.rb, line 18 def self.log(event, args = {}) data = {} data["app"] = app_name data["time"] = Time.now.utc.strftime("%FT%T") data["event"] = event puts JSON.dump(data.merge(args)) end