log

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 5,307

Documentation

Index

Constants

View Source
const (
	// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
	// ensure the formatted time is always the same number of characters.
	RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"

	// TextFormat represents the text logging format
	TextFormat = "text"

	// JSONFormat represents the JSON logging format
	JSONFormat = "json"

	// TraceLevel level.
	TraceLevel = logrus.TraceLevel

	// DebugLevel level.
	DebugLevel = logrus.DebugLevel

	// InfoLevel level.
	InfoLevel = logrus.InfoLevel
)

Variables

View Source
var (
	// G is an alias for GetLogger.
	//
	// We may want to define this locally to a package to get package tagged log
	// messages.
	G = GetLogger

	// L is an alias for the standard logger.
	L = logrus.NewEntry(logrus.StandardLogger())
)

Functions

func GetLogger

func GetLogger(ctx context.Context) *logrus.Entry

GetLogger retrieves the current logger from the context. If no logger is available, the default logger is returned.

func SetFormat added in v1.6.22

func SetFormat(format string) error

SetFormat sets log output format

func SetLevel added in v1.6.22

func SetLevel(level string) error

SetLevel sets log level globally.

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

WithLogger returns a new context with the provided logger. Use in combination with logger.WithField(s) for great effect.

Types

type Fields added in v1.6.22

type Fields = logrus.Fields

Fields type to pass to `WithFields`, alias from `logrus`.

type Level added in v1.6.22

type Level = logrus.Level

Level is a logging level

func GetLevel added in v1.6.22

func GetLevel() Level

GetLevel returns the current log level.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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