eventlog

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyExists = fmt.Errorf("%s\\%s already exists", addKeyName, source)

ErrKeyExists signals that the registry key already exists

View Source
var ErrUnknownEventID = errors.New("unknown event id found")

ErrUnknownEventID represents the error for signaling unknown event identifiers. This error is raised when we can't get a valid mapping for the existing kernel event type.

Functions

func AddFlags

func AddFlags(flags *pflag.FlagSet)

AddFlags registers persistent flags.

func Install

func Install(src, msgFile string, useExpandKey bool, eventsSupported uint32) 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.

Types

type Config

type Config struct {
	// Enabled determines whether the eventlog output is enabled.
	Enabled bool `mapstructure:"enabled"`
	// Level specifies the eventlog log level.
	Level string `mapstructure:"level"`
	// RemoteHost is the address of the remote eventlog intake.
	RemoteHost string `mapstructure:"remote-host"`
	// Template specifies the Go template for rendering the eventlog message.
	Template string `mapstructure:"template"`
}

Config contains configuration properties for fine-tuning the eventlog output.

type Eventlog

type Eventlog struct {
	Handle windows.Handle
}

Eventlog provides access to the system log.

func Open

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

Open retrieves a handle to the specified event log.

func OpenRemote

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

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

func (*Eventlog) Close

func (l *Eventlog) Close() error

Close closes event log.

func (*Eventlog) Error

func (l *Eventlog) Error(eid uint32, category uint16, msg []byte) error

Error writes an error event msg with event id eid to the end of event log.

func (*Eventlog) Info

func (l *Eventlog) Info(eid uint32, category uint16, msg []byte) error

Info writes an information event msg with event id eid to the end of event log.

func (*Eventlog) Warning

func (l *Eventlog) Warning(eid uint32, category uint16, msg []byte) error

Warning writes an warning event msg with event id eid to the end of event log.

type Level

type Level uint16

Level is the type definition for the eventlog log level

const (
	// Info represents the info log level
	Info Level = 4
	// Warn represents the warning info level
	Warn Level = 2
	// Erro represents the error log level
	Erro Level = 1
)

Jump to

Keyboard shortcuts

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