log

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 11 Imported by: 28

Documentation

Index

Constants

View Source
const TraceLevel = chlog.DebugLevel - 10

Variables

View Source
var ForceColorInCI = true //nolint:gochecknoglobals // Intended, to be disabled if really needed.

Functions

func Debug

func Debug(msg string, args ...any)

Debug will log a debug info.

func Debugf

func Debugf(msg string, args ...any)

Debugf will log a debug info with formatting.

func Error

func Error(msg string, args ...any)

Error will log an error.

func ErrorE

func ErrorE(err error, msg string, args ...any)

ErrorE will log an error for `err`.

func ErrorEf

func ErrorEf(err error, msg string, args ...any)

ErrorEf will log an error for `err` with formatting.

func Errorf

func Errorf(msg string, args ...any)

Errorf will log an error with formatting.

func Info

func Info(msg string, args ...any)

Info will log an info.

func Infof

func Infof(msg string, args ...any)

Infof will log an info with formatting.

func IsDebug

func IsDebug() bool

IsDebug checks if debug is enabled on the log.

func Panic

func Panic(msg string, args ...any)

Panic will log and panic.

func PanicE

func PanicE(err error, msg string, args ...any)

PanicE will log and panic if `err` is not `nil`.

func PanicEf

func PanicEf(err error, msg string, args ...any)

PanicEf will log and panic with formatting.

func Panicf

func Panicf(msg string, args ...any)

Panicf will log and panic with formatting.

func SetLevel

func SetLevel(level string) error

func Setup

func Setup(level string) (err error)

Setup sets up the default loggers .

func Trace

func Trace(msg string, args ...any)

Trace will log a trace info.

func Tracef

func Tracef(msg string, args ...any)

Tracef will log a trace info with formatting.

func Warn

func Warn(msg string, args ...any)

Warn will log an warning info.

func WarnE

func WarnE(err error, msg string, args ...any)

WarnE will log a warning for an error `err`.

func WarnEf

func WarnEf(err error, msg string, args ...any)

WarnEf will log a warning for an error `err` with formatting.

func Warnf

func Warnf(msg string, args ...any)

Warnf will log a warning info with formatting.

Types

type ILog

type ILog interface {
	// Trace will log an trace if trace is enabled.
	Trace(msg string, args ...any)
	Tracef(msg string, args ...any)

	// Debug will log an info if debug is enabled.
	Debug(msg string, args ...any)
	Debugf(msg string, args ...any)

	// Info will log an info.
	Info(msg string, args ...any)
	Infof(msg string, args ...any)

	// Warn will log an info.
	Warn(msg string, args ...any)
	Warnf(msg string, args ...any)

	// Warn will log a warning for an error `err`.
	WarnE(err error, msg string, args ...any)

	// Error will log an error.
	Error(msg string, args ...any)
	Errorf(msg string, args ...any)

	// Error will log an error for `err`.
	ErrorE(err error, msg string, args ...any)
	ErrorEf(err error, msg string, args ...any)

	// Panic will log and panic.
	Panic(msg string, args ...any)
	Panicf(msg string, args ...any)

	// PanicE will log and panic if `err` is not `nil`.
	PanicE(err error, msg string, args ...any)
	PanicEf(err error, msg string, args ...any)
}

func Global added in v0.28.0

func Global() ILog

Global returns the global logger.

func NewLogger added in v0.27.0

func NewLogger(prefix string) ILog

NewLogger creates a threadsafe logger with structured key/value pairs added.

Jump to

Keyboard shortcuts

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