Skip to content

Commit

Permalink
Added error
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym committed May 12, 2015
1 parent 6687bae commit e57f5c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ext/win32-eventlog/chef-log.man
Expand Up @@ -44,6 +44,12 @@ Language=English
.

MessageId=10103
SymbolicName=ERROR
Language=English
[ERROR] %1
.

MessageId=10104
SymbolicName=FATAL
Language=English
[FATAL] %1
Expand Down
12 changes: 11 additions & 1 deletion lib/chef/log/winevt.rb
Expand Up @@ -32,7 +32,8 @@ class WinEvt
INFO_EVENT_ID = 10100
WARN_EVENT_ID = 10101
DEBUG_EVENT_ID = 10102
FATAL_EVENT_ID = 10103
ERROR_EVENT_ID = 10103
FATAL_EVENT_ID = 10104

# Since we must install the event logger, this is not really configurable
SOURCE = 'Chef'
Expand Down Expand Up @@ -75,6 +76,15 @@ def debug(msg)
)
end

def error(msg)
@eventlog.report_event(
:event_type => ::Win32::EventLog::ERROR_TYPE,
:source => SOURCE,
:event_id => ERROR_EVENT_ID,
:data => [msg]
)
end

def fatal(msg)
@eventlog.report_event(
:event_type => ::Win32::EventLog::ERROR_TYPE,
Expand Down

0 comments on commit e57f5c1

Please sign in to comment.