fakewinlog

package
v0.0.0-...-dfc23e4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fakewinlog provides test doubles (fakes and stubs) for the simple package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeWindowsAPI

type FakeWindowsAPI struct {
	Events map[string][]string
	// contains filtered or unexported fields
}

FakeWindowsAPI provides a fake implementation of winlog's simple.Event interface. It is limited in the following ways:

1) Only query keys are used, and values are ignored (assumed to be "*").

2) All available events must be held in memory, in the Events field.

3) There is no thread-safety whatsoever.

func (*FakeWindowsAPI) Append

func (w *FakeWindowsAPI) Append(events map[string][]string)

Append adds more events to w.Events.

func (*FakeWindowsAPI) Bookmark

func (w *FakeWindowsAPI) Bookmark() (string, error)

Bookmark returns a bookmark value that can be passed to Subscribe to resume consuming Events in the future.

func (*FakeWindowsAPI) Close

func (w *FakeWindowsAPI) Close() error

Close closes the subscription.

func (*FakeWindowsAPI) RenderedEvents

func (w *FakeWindowsAPI) RenderedEvents(max int) (events []string, done bool, err error)

RenderedEvents returns up to `max` events from w.Events, if they match the query provided to Subscribe. If no further events are available after this call, the boolean return value will be set to true.

func (*FakeWindowsAPI) ResetEvent

func (w *FakeWindowsAPI) ResetEvent() error

ResetEvent does nothing, unsuccessfully.

func (*FakeWindowsAPI) Subscribe

func (w *FakeWindowsAPI) Subscribe(bookmark string, query map[string]string) error

Subscribe initializes a subscription for Windows Event Log. Close must be called when finished.

func (*FakeWindowsAPI) WaitForSingleObject

func (w *FakeWindowsAPI) WaitForSingleObject(timeout time.Duration) (bool, error)

WaitForSingleObject simulates waiting for events to be available.

Jump to

Keyboard shortcuts

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