Class: Chef::Log::WinEvt
- Inherits:
-
Object
- Object
- Chef::Log::WinEvt
- Includes:
- Mixin::Unformatter
- Defined in:
- lib/chef/log/winevt.rb
Overview
Chef::Log::WinEvt class. usage in client.rb: log_location Chef::Log::WinEvt.new
Constant Summary collapse
- INFO_EVENT_ID =
These must match those that are defined in the manifest file
10100
- WARN_EVENT_ID =
10101
- DEBUG_EVENT_ID =
10102
- ERROR_EVENT_ID =
10103
- FATAL_EVENT_ID =
10104
- SOURCE =
Since we must install the event logger, this is not really configurable
ChefUtils::Dist::Infra::SHORT.freeze
Instance Attribute Summary collapse
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#level ⇒ Object
Returns the value of attribute level.
-
#sync ⇒ Object
Returns the value of attribute sync.
Instance Method Summary collapse
- #close ⇒ Object
- #debug(msg) ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize(eventlog = nil) ⇒ WinEvt
constructor
A new instance of WinEvt.
- #warn(msg) ⇒ Object
Methods included from Mixin::Unformatter
Constructor Details
Instance Attribute Details
#formatter ⇒ Object
Returns the value of attribute formatter.
44 45 46 |
# File 'lib/chef/log/winevt.rb', line 44 def formatter @formatter end |
#level ⇒ Object
Returns the value of attribute level.
44 45 46 |
# File 'lib/chef/log/winevt.rb', line 44 def level @level end |
#sync ⇒ Object
Returns the value of attribute sync.
44 45 46 |
# File 'lib/chef/log/winevt.rb', line 44 def sync @sync end |
Instance Method Details
#close ⇒ Object
50 |
# File 'lib/chef/log/winevt.rb', line 50 def close; end |
#debug(msg) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/chef/log/winevt.rb', line 70 def debug(msg) @eventlog.report_event( event_type: ::Win32::EventLog::INFO_TYPE, source: SOURCE, event_id: DEBUG_EVENT_ID, data: [msg] ) end |
#error(msg) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/chef/log/winevt.rb', line 79 def error(msg) @eventlog.report_event( event_type: ::Win32::EventLog::ERROR_TYPE, source: SOURCE, event_id: ERROR_EVENT_ID, data: [msg] ) end |
#fatal(msg) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/chef/log/winevt.rb', line 88 def fatal(msg) @eventlog.report_event( event_type: ::Win32::EventLog::ERROR_TYPE, source: SOURCE, event_id: FATAL_EVENT_ID, data: [msg] ) end |
#info(msg) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/chef/log/winevt.rb', line 52 def info(msg) @eventlog.report_event( event_type: ::Win32::EventLog::INFO_TYPE, source: SOURCE, event_id: INFO_EVENT_ID, data: [msg] ) end |
#warn(msg) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/chef/log/winevt.rb', line 61 def warn(msg) @eventlog.report_event( event_type: ::Win32::EventLog::WARN_TYPE, source: SOURCE, event_id: WARN_EVENT_ID, data: [msg] ) end |