package etwlogrus
import "github.com/Microsoft/go-winio/pkg/etwlogrus"
Index ¶
- Variables
- type Hook
- func NewHook(providerName string, opts ...HookOpt) (*Hook, error)
- func NewHookFromOpts(opts ...HookOpt) (*Hook, error)
- func NewHookFromProvider(provider *etw.Provider, opts ...HookOpt) (*Hook, error)
- func (h *Hook) Close() error
- func (h *Hook) Fire(e *logrus.Entry) error
- func (*Hook) Levels() []logrus.Level
- type HookOpt
Variables ¶
ErrNoProvider is returned when a hook is created without a provider being configured.
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook is a Logrus hook which logs received events to ETW.
func NewHook ¶
NewHook registers a new ETW provider and returns a hook to log from it. The provider will be closed when the hook is closed.
func NewHookFromOpts ¶
NewHookFromOpts creates a new hook with the provided options. An error is returned if the hook does not have a valid provider.
func NewHookFromProvider ¶
NewHookFromProvider creates a new hook based on an existing ETW provider. The provider will not be closed when the hook is closed.
func (*Hook) Close ¶
Close cleans up the hook and closes the ETW provider. If the provder was registered by etwlogrus, it will be closed as part of `Close`. If the provider was passed in, it will not be closed.
func (*Hook) Fire ¶
Fire receives each Logrus entry as it is logged, and logs it to ETW.
func (*Hook) Levels ¶
Levels returns the set of levels that this hook wants to receive log entries for.
type HookOpt ¶
HookOpt is an option to change the behavior of the Logrus ETW hook.
func WithEventOpts ¶
WithEventOpts allows additional ETW event properties (keywords, tags, etc.) to be specified.
func WithExistingETWProvider ¶
WithExistingETWProvider configures the hook to use an existing ETW provider. The provider will not be closed when the hook is closed.
func WithGetName ¶
WithGetName sets the ETW EventName of an event to the value returned by f If the name is empty, the default event name will be used.
func WithNewETWProvider ¶
WithNewETWProvider registers a new ETW provider and sets the hook to log using it. The provider will be closed when the hook is closed.
Source Files ¶
- Version
- v0.6.1
- Published
- Apr 14, 2023
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 8 hours ago –
Tools for package owners.