go-winio: github.com/microsoft/go-winio/pkg/etwlogrus Index | Files

package etwlogrus

import "github.com/microsoft/go-winio/pkg/etwlogrus"


Package Files


type Hook Uses

type Hook struct {
    // contains filtered or unexported fields

Hook is a Logrus hook which logs received events to ETW.

func NewHook Uses

func NewHook(providerName string) (*Hook, error)

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 NewHookFromProvider Uses

func NewHookFromProvider(provider *etw.Provider) (*Hook, error)

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 Uses

func (h *Hook) Close() error

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 Uses

func (h *Hook) Fire(e *logrus.Entry) error

Fire receives each Logrus entry as it is logged, and logs it to ETW.

func (*Hook) Levels Uses

func (h *Hook) Levels() []logrus.Level

Levels returns the set of levels that this hook wants to receive log entries for.

Package etwlogrus imports 3 packages (graph). Updated 2019-06-30. Refresh now. Tools for package owners.