Documentation ¶
Overview ¶
Package fakewinlog provides test doubles (fakes and stubs) for the simple package.
Index ¶
- type FakeWindowsAPI
- func (w *FakeWindowsAPI) Append(events map[string][]string)
- func (w *FakeWindowsAPI) Bookmark() (string, error)
- func (w *FakeWindowsAPI) Close() error
- func (w *FakeWindowsAPI) RenderedEvents(max int) (events []string, done bool, err error)
- func (w *FakeWindowsAPI) ResetEvent() error
- func (w *FakeWindowsAPI) Subscribe(bookmark string, query map[string]string) error
- func (w *FakeWindowsAPI) WaitForSingleObject(timeout time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeWindowsAPI ¶
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.