logging

package
v18.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 14 Imported by: 27

Documentation

Index

Constants

View Source
const (
	LogRoot              = "/var/log/" + config.OrchestratorName
	LogRotationThreshold = 10485760 // 10 MB
	MaxLogEntryLength    = 64000
)

Variables

This section is empty.

Functions

func InitLogLevel

func InitLogLevel(debug bool, logLevel string) error

InitLogLevel configures the logging level. The debug flag takes precedence if set, otherwise the logLevel flag (debug, info, warn, error, fatal) is used.

func InitLogging

func InitLogging(logName string) error

InitLogging configures logging for nDVP. Logs are written both to a log file as well as stdout/stderr. Since logrus doesn't support multiple writers, each log stream is implemented as a hook.

Types

type ConsoleHook

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

ConsoleHook sends log entries to stdout.

func NewConsoleHook

func NewConsoleHook() *ConsoleHook

NewConsoleHook creates a new log hook for writing to stdout/stderr.

func (*ConsoleHook) Fire

func (hook *ConsoleHook) Fire(entry *log.Entry) error

func (*ConsoleHook) Levels

func (hook *ConsoleHook) Levels() []log.Level

type FileHook

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

FileHook sends log entries to a file.

func NewFileHook

func NewFileHook(logName string) (*FileHook, error)

NewFileHook creates a new log hook for writing to a file.

func (*FileHook) Fire

func (hook *FileHook) Fire(entry *log.Entry) error

func (*FileHook) GetLocation

func (hook *FileHook) GetLocation() string

func (*FileHook) Levels

func (hook *FileHook) Levels() []log.Level

type PlainTextFormatter

type PlainTextFormatter struct {

	// TimestampFormat to use for display when a full timestamp is printed
	TimestampFormat string

	// The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting bool
}

PlainTextFormatter is a formatter than does no coloring *and* does not insist on writing logs as key/value pairs.

func (*PlainTextFormatter) Format

func (f *PlainTextFormatter) Format(entry *log.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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