logging

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHooks added in v0.9.0

func DefaultHooks() []logrus.Hook

DefaultHooks returns a slice of the default logrus hooks to be used by a logger.

func DefaultLogger added in v0.9.0

func DefaultLogger(level logrus.Level) *logrus.Logger

DefaultLogger returns a Logger with the default properties and hooks.

Types

type ErrorLocationHook

type ErrorLocationHook struct {
}

ErrorLocationHook is a logrus hook that attaches error location information to log entries if an error is being logged and it has stack-trace information (i.e. if it originates from or is wrapped by github.com/pkg/errors).

func (*ErrorLocationHook) Fire

func (h *ErrorLocationHook) Fire(entry *logrus.Entry) error

func (*ErrorLocationHook) Levels

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

type HcLogLevelHook added in v0.6.0

type HcLogLevelHook struct{}

HcLogLevelHook adds an hclog-compatible field ("@level") containing the log level. Note that if you use this, you SHOULD NOT use logrus.JSONFormatter's FieldMap to set the level key to "@level" because that will result in the hclog-compatible info written here being overwritten.

func (*HcLogLevelHook) Fire added in v0.6.0

func (h *HcLogLevelHook) Fire(entry *logrus.Entry) error

func (*HcLogLevelHook) Levels added in v0.6.0

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

type LevelFlag added in v0.9.0

type LevelFlag struct {
	*flag.Enum
	// contains filtered or unexported fields
}

LevelFlag is a command-line flag for setting the logrus log level.

func LogLevelFlag added in v0.9.0

func LogLevelFlag(defaultValue logrus.Level) *LevelFlag

LogLevelFlag constructs a new log level flag.

func (*LevelFlag) Parse added in v0.9.0

func (f *LevelFlag) Parse() logrus.Level

Parse returns the flag's value as a logrus.Level.

type LogLocationHook

type LogLocationHook struct {
	// contains filtered or unexported fields
}

LogLocationHook is a logrus hook that attaches location information to log entries, i.e. the file and line number of the logrus log call. This hook is designed for use in both the Ark server and Ark plugin implementations. When triggered within a plugin, a marker field will be set on the log entry indicating that the location came from a plugin. The Ark server instance will not overwrite location information if it sees this marker.

func (*LogLocationHook) Fire

func (h *LogLocationHook) Fire(entry *logrus.Entry) error

func (*LogLocationHook) Levels

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

func (*LogLocationHook) WithLoggerName added in v0.6.0

func (h *LogLocationHook) WithLoggerName(name string) *LogLocationHook

WithLoggerName gives the hook a name to use when setting the marker field on a log entry indicating the location has been recorded by a plugin. This should only be used when setting up a hook for a logger used in a plugin.

type LogSetter added in v0.6.0

type LogSetter interface {
	SetLog(logrus.FieldLogger)
}

LogSetter is an interface for a type that allows a FieldLogger to be set on it.

Jump to

Keyboard shortcuts

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