Documentation ¶
Overview ¶
Package eventlog implements access to Windows event log.
Index ¶
- Constants
- func Install(provider, src, msgFile string, useExpandKey bool, eventsSupported uint32) (bool, error)
- func InstallAsEventCreate(provider, src string, eventsSupported uint32) (bool, error)
- func RemoveProvider(provider string) error
- func RemoveSource(provider, src string) error
- type Log
- func (l *Log) AuditFailure(eid uint32, msg string) error
- func (l *Log) AuditSuccess(eid uint32, msg string) error
- func (l *Log) Close() error
- func (l *Log) Error(eid uint32, msg string) error
- func (l *Log) Info(eid uint32, msg string) error
- func (l *Log) Report(etype uint16, eid uint32, msgs []string) error
- func (l *Log) Success(eid uint32, msg string) error
- func (l *Log) Warning(eid uint32, msg string) error
Constants ¶
const ( // Log levels. Success = windows.EVENTLOG_SUCCESS Info = windows.EVENTLOG_INFORMATION_TYPE Warning = windows.EVENTLOG_WARNING_TYPE Error = windows.EVENTLOG_ERROR_TYPE AuditSuccess = windows.EVENTLOG_AUDIT_SUCCESS AuditFailure = windows.EVENTLOG_AUDIT_FAILURE )
const Application = "Application"
Application event log provider.
Variables ¶
This section is empty.
Functions ¶
func Install ¶
func Install(provider, src, msgFile string, useExpandKey bool, eventsSupported uint32) (bool, error)
Install modifies PC registry to allow logging with an event source src. It adds all required keys and values to the event log registry key. Install uses msgFile as the event message file. If useExpandKey is true, the event message file is installed as REG_EXPAND_SZ value, otherwise as REG_SZ. Use bitwise of log.Error, log.Warning and log.Info to specify events supported by the new event source.
func InstallAsEventCreate ¶
InstallAsEventCreate is the same as Install, but uses %SystemRoot%\System32\EventCreate.exe as the event message file.
func RemoveProvider ¶
Remove deletes all registry elements installed for an event logging provider. Only use this method if you have installed a custom provider.
func RemoveSource ¶
Remove deletes all registry elements installed for an event logging source.
Types ¶
type Log ¶
Log provides access to the system log.
func OpenRemote ¶
OpenRemote does the same as Open, but on different computer host.
func (*Log) AuditFailure ¶
AuditFailure writes an audit event msg with event id eid to the end of event log l. When EventCreate.exe is used, eid must be between 1 and 1000.
func (*Log) AuditSuccess ¶
AuditSuccess writes an audit event msg with event id eid to the end of event log l. When EventCreate.exe is used, eid must be between 1 and 1000.
func (*Log) Error ¶
Error writes an error event msg with event id eid to the end of event log l. When EventCreate.exe is used, eid must be between 1 and 1000.
func (*Log) Info ¶
Info writes an information event msg with event id eid to the end of event log l. When EventCreate.exe is used, eid must be between 1 and 1000.
func (*Log) Report ¶
Report write an event message with event type etype and event ID eid to the end of event log l. etype should be one of Info, Success, Warning, Error, AuditSuccess, or AuditFailure. When EventCreate.exe is used, eid must be between 1 and 1000.