eventlog

package
v0.0.0-...-5c85c1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package eventlog implements access to Windows event log.

Index

Constants

Variables

This section is empty.

Functions

func Install

func Install(src, msgFile string, useExpandKey bool, eventsSupported uint32) error

Install modifies PC registry to allow logging with event source src. It adds all required keys/values to event log key. Install uses msgFile as event message file, creating key as REG_EXPAND_SZ, if useExpandKey is true, otherwise as REG_SZ. Use bitwise of log.Error, log.Warning and log.Info to specify events supported.

func InstallAsEventCreate

func InstallAsEventCreate(src string, eventsSupported uint32) error

InstallAsEventCreate is the same as Install, but uses %SystemRoot%\System32\EventCreate.exe as event message file.

func Remove

func Remove(src string) error

Remove deletes all registry elements installed by correspondent Install.

Types

type Log

type Log struct {
	Handle syscall.Handle
}

Log provides access to system log.

func Open

func Open(source string) (*Log, error)

Open retrieves a handle to the specified event log.

func OpenRemote

func OpenRemote(host, source string) (*Log, error)

OpenRemote does the same as Open, but on different computer host.

func (*Log) Close

func (l *Log) Close() error

Close closes event log l.

func (*Log) Error

func (l *Log) Error(eid uint32, msg string) error

Error writes an error event msg with event id eid to the end of event log l. eid must be between 1 and 1000 if using EventCreate.exe as event message file.

func (*Log) Info

func (l *Log) Info(eid uint32, msg string) error

Info writes an information event msg with event id eid to the end of event log l. eid must be between 1 and 1000 if using EventCreate.exe as event message file.

func (*Log) Warning

func (l *Log) Warning(eid uint32, msg string) error

Warning writes an warning event msg with event id eid to the end of event log l. eid must be between 1 and 1000 if using EventCreate.exe as event message file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL