Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string, v ...interface{})

Debug debug log

func Error

func Error(message string, v ...interface{})

Error error log

func Fatal

func Fatal(message string, v ...interface{})

Fatal fatal log Calls os.Exit(1) after logging

func Info

func Info(message string, v ...interface{})

Info info log

func Panic

func Panic(message string, v ...interface{})

Panic panic log Calls panic() after logging

func SetFormatter

func SetFormatter(format Format)

SetFormatter 0=JSON, 1=TEXT

func SetLevel

func SetLevel(level Level)

SetLevel log level

func SetOutput

func SetOutput(out io.Writer)

SetOutput log writer

func Trace

func Trace(message string, v ...interface{})

Trace trace log

func Warn

func Warn(message string, v ...interface{})

Warn warn log

Types

type Entry

type Entry struct {
	*logrus.Entry
}

Entry the log entry

func With

func With(fields F) *Entry

With fields

func (*Entry) Debug

func (entry *Entry) Debug(message string, v ...interface{})

Debug debug log

func (*Entry) Error

func (entry *Entry) Error(message string, v ...interface{})

Error error log

func (*Entry) Fatal

func (entry *Entry) Fatal(message string, v ...interface{})

Fatal fatal log Calls os.Exit(1) after logging

func (*Entry) Info

func (entry *Entry) Info(message string, v ...interface{})

Info info log

func (*Entry) Panic

func (entry *Entry) Panic(message string, v ...interface{})

Panic panic log Calls panic() after logging

func (*Entry) Trace

func (entry *Entry) Trace(message string, v ...interface{})

Trace trace log

func (*Entry) Warn

func (entry *Entry) Warn(message string, v ...interface{})

Warn warn log

type F

type F map[string]interface{}

F the log fields

type Format

type Format uint32

Format type

const (
	// JSON JSON Format
	JSON Format = iota
	// TEXT Text Format
	TEXT = 1 // 1
)

type Level

type Level uint32

Level type

const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel Level = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

These are the different logging levels. You can set the logging level to log on your instance of logger, obtained with `logrus.New()`.

func GetLevel

func GetLevel() Level

GetLevel get log level

type Logger added in v1.0.0

type Logger struct {
	*logrus.Logger
}

Logger the logrus logger

func StandardLogger added in v1.0.0

func StandardLogger() *Logger

StandardLogger returns the standard logger

Jump to

Keyboard shortcuts

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