Class: Steno::Sink::Eventlog
- Includes:
- Singleton
- Defined in:
- lib/steno/sink/eventlog.rb
Constant Summary collapse
- LOG_LEVEL_MAP =
{ fatal: Win32::EventLog::ERROR_TYPE, error: Win32::EventLog::ERROR_TYPE, warn: Win32::EventLog::WARN_TYPE, info: Win32::EventLog::INFO_TYPE, debug: Win32::EventLog::INFO_TYPE, debug1: Win32::EventLog::INFO_TYPE, debug2: Win32::EventLog::INFO_TYPE }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #add_record(record) ⇒ Object
- #flush ⇒ Object
-
#initialize ⇒ Eventlog
constructor
A new instance of Eventlog.
- #open ⇒ Object
Constructor Details
#initialize ⇒ Eventlog
Returns a new instance of Eventlog.
21 22 23 24 |
# File 'lib/steno/sink/eventlog.rb', line 21 def initialize super @eventlog = nil end |
Instance Method Details
#add_record(record) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/steno/sink/eventlog.rb', line 30 def add_record(record) msg = @codec.encode_record(record) pri = LOG_LEVEL_MAP[record.log_level] @eventlog.report_event( source: 'CloudFoundry', event_type: pri, data: msg ) end |
#flush ⇒ Object
41 42 43 |
# File 'lib/steno/sink/eventlog.rb', line 41 def flush nil end |
#open ⇒ Object
26 27 28 |
# File 'lib/steno/sink/eventlog.rb', line 26 def open @eventlog = Win32::EventLog.open('Application') end |