Class: Lines::SyslogOutputter
- Inherits:
-
Object
- Object
- Lines::SyslogOutputter
- Defined in:
- lib/lines.rb
Constant Summary collapse
- PRI2SYSLOG =
{ debug: Syslog::LOG_DEBUG, info: Syslog::LOG_INFO, warn: Syslog::LOG_WARNING, warning: Syslog::LOG_WARNING, err: Syslog::LOG_ERR, error: Syslog::LOG_ERR, crit: Syslog::LOG_CRIT, critical: Syslog::LOG_CRIT, }
Instance Method Summary collapse
-
#initialize(syslog = Syslog, app_name = nil) ⇒ SyslogOutputter
constructor
A new instance of SyslogOutputter.
- #output(dumper, obj) ⇒ Object
Constructor Details
#initialize(syslog = Syslog, app_name = nil) ⇒ SyslogOutputter
Returns a new instance of SyslogOutputter.
159 160 161 162 163 |
# File 'lib/lines.rb', line 159 def initialize(syslog = Syslog, app_name=nil) @app_name = app_name @syslog = syslog prepare_syslog end |
Instance Method Details
#output(dumper, obj) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/lines.rb', line 165 def output(dumper, obj) obj = obj.dup obj.delete(:pid) # It's going to be part of the message obj.delete(:at) # Also part of the message obj.delete(:app) # And again level = extract_pri(obj) str = dumper.dump(obj) syslog.log(level, str) end |