logging

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertLogrusLevelToSlf4goLevel

func ConvertLogrusLevelToSlf4goLevel(logrusLevel log.Level) slog.Level

ConvertLogrusLevelToSlf4goLevel converts a log level from logrus to slf4go.

func ConvertSlf4goLevelToLogrusLevel

func ConvertSlf4goLevelToLogrusLevel(slfLevel slog.Level) log.Level

ConvertSlf4goLevelToLogrusLevel converts a log level from slf4go to logrus.

func InitLogger

func InitLogger(settings api.Settings) error

InitLogger creates and returns a new logger instance based on the specified command line logger level flag.

Types

type LogrusDriver

type LogrusDriver struct {
	// LoggerToLevelMapping allows you to specify a logger name that you want to assign a specific log level
	LoggerToLevelMapping map[string]slog.Level
	// When enabled the logger name is appended to the start of all log lines
	PrependLoggerName bool
}

LogrusDriver is a slf4go compatible logger implementation.

func (*LogrusDriver) GetLevel

func (ld *LogrusDriver) GetLevel(logger string) slog.Level

GetLevel retrieves the log level of the specified logger, it should return the lowest Level that could be print, which can help invoker to decide whether prepare print or not.

func (*LogrusDriver) Name

func (ld *LogrusDriver) Name() string

Name indicates the name of the logger implementation.

func (*LogrusDriver) Print

func (ld *LogrusDriver) Print(sl *slog.Log)

Print outputs the log line using the backing logrus driver implementation.

Jump to

Keyboard shortcuts

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