log

package
v0.0.0-...-fa720cf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 15 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugLevel = logrus.DebugLevel
View Source
var ErrorLevel = logrus.ErrorLevel
View Source
var FatalLevel = logrus.FatalLevel
View Source
var InfoLevel = logrus.InfoLevel
View Source
var PanicLevel = logrus.PanicLevel
View Source
var TraceLevel = logrus.TraceLevel
View Source
var WarnLevel = logrus.WarnLevel

Functions

func ConfigureLogger

func ConfigureLogger(conf Logger)

ConfigureLogger configures the global and local logrus logger

func Debug

func Debug(args ...interface{})

Debug log message

func Debugf

func Debugf(format string, args ...interface{})

Debugf log message

func Debugln

func Debugln(args ...interface{})

Debugln log message

func Error

func Error(args ...interface{})

Error log message

func Errorf

func Errorf(format string, args ...interface{})

Errorf log message

func Errorln

func Errorln(args ...interface{})

Errorln log message

func GetLogger

func GetLogger() *logrus.Logger

GetLogger returns the configured logger instance

func Info

func Info(args ...interface{})

Info log message

func Infof

func Infof(format string, args ...interface{})

Infof log message

func Infoln

func Infoln(args ...interface{})

Infoln log message

func Warning

func Warning(args ...interface{})

Warning log message

func Warningf

func Warningf(format string, args ...interface{})

Warningf log message

func Warningln

func Warningln(args ...interface{})

Warningln log message

Types

type Entry

type Entry = logrus.Entry

Entry is a logrus.Entry

func Sub

func Sub(ns string) *Entry

Sub is a shortcut for log.WithFields(log.Fields{"namespace": ns}), it creates a new logger which inherits the parent's configuration but changes the namespace.

func WithField

func WithField(key string, value interface{}) *Entry

WithField creates an entry from the standard logger and adds a field to it.

func WithFields

func WithFields(fields Fields) *Entry

WithFields creates an entry from the standard logger and adds multiple fields to it.

type Fields

type Fields = logrus.Fields

Fields type, used to pass to `WithFields`.

type JSONFormatConfig

type JSONFormatConfig struct {
	DisableTimestamp bool
	TimestampFormat  string
}

JSONFormatConfig provides configuration for the JSON logger format.

type Logger

type Logger struct {
	Level      string
	Formatter  string
	OutputFile string
	JSONFormat JSONFormatConfig
	TextFormat TextFormatConfig
}

Logger provides configuration for a logger.

func DefaultLoggerConfig

func DefaultLoggerConfig() Logger

DefaultLoggerConfig returns a Logger instance with default values.

type TextFormatConfig

type TextFormatConfig struct {
	// Set to true to bypass checking for a TTY before outputting colors.
	ForceColors bool

	// Force disabling colors.
	DisableColors bool

	// Disable timestamp logging. useful when output is redirected to logging
	// system that already adds timestamps.
	DisableTimestamp bool

	// 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

	Indent string
}

TextFormatConfig provides configuration for the text logger format.

Jump to

Keyboard shortcuts

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