logging

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SLevel = "syslog.level"

	Syslog = "syslog"
)

Variables

View Source
var (
	// DefaultLogger is the base logrus logger. It is different from the logrus
	// default to avoid external dependencies from writing out unexpectedly
	DefaultLogger = InitializeDefaultLogger()

	// DefaultLogLevel is the alternative we provide to Debug
	DefaultLogLevel = logrus.InfoLevel
)

Functions

func CanLogAt

func CanLogAt(logger *logrus.Logger, level logrus.Level) bool

CanLogAt returns whether a log message at the given level would be logged by the given logger.

func GetLevel

func GetLevel(logger *logrus.Logger) logrus.Level

GetLevel returns the log level of the given logger.

func InitializeDefaultLogger

func InitializeDefaultLogger() *logrus.Logger

InitializeDefaultLogger returns a logrus Logger with a custom text formatter.

func MultiLine

func MultiLine(logFn func(args ...interface{}), output string)

MultiLine breaks a multi line text into individual log entries and calls the logging function to log each entry

func SetLogLevel

func SetLogLevel(level logrus.Level)

SetLogLevel sets the log level on DefaultLogger. This logger is, by convention, the base logger for package specific ones thus setting the level here impacts the default logging behaviour. This function is thread-safe when logging, reading DefaultLogger.Level is not protected this way, however.

func SetupLogging

func SetupLogging(loggers []string, logOpts map[string]string, tag string, debug bool) error

SetupLogging sets up each logging service provided in loggers and configures each logger with the provided logOpts.

func ToggleDebugLogs

func ToggleDebugLogs(debug bool)

ToggleDebugLogs switches on or off debugging logs. It will select DefaultLogLevel when turning debug off. It is thread-safe.

Types

This section is empty.

Directories

Path Synopsis
Package logfields defines common logging fields which are used across packages
Package logfields defines common logging fields which are used across packages

Jump to

Keyboard shortcuts

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