trlogger

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var GlobalTrLogger = DefaultTrLogger()

Functions

func Debug

func Debug(ctx context.Context, args ...any)

func Debugf

func Debugf(ctx context.Context, format string, args ...any)

func Debugln

func Debugln(ctx context.Context, args ...any)

func Error

func Error(ctx context.Context, args ...any)

func Errorf

func Errorf(ctx context.Context, format string, args ...any)

func Errorln

func Errorln(ctx context.Context, args ...any)

func Fatal

func Fatal(ctx context.Context, args ...any)

func Fatalf

func Fatalf(ctx context.Context, format string, args ...any)

func Fatalln

func Fatalln(ctx context.Context, args ...any)

func Info

func Info(ctx context.Context, args ...any)

func Infof

func Infof(ctx context.Context, format string, args ...any)

func Infoln

func Infoln(ctx context.Context, args ...any)

func IsDebugLevel

func IsDebugLevel() bool

IsDebugLevel check if Level is LevelDebug

func Panic

func Panic(ctx context.Context, args ...any)

func Panicf

func Panicf(ctx context.Context, format string, args ...any)

func Panicln

func Panicln(ctx context.Context, args ...any)

func Warn

func Warn(ctx context.Context, args ...any)

func Warnf

func Warnf(ctx context.Context, format string, args ...any)

func Warnln

func Warnln(ctx context.Context, args ...any)

Types

type Level

type Level int8

Level type of log level

func GetConfiguredLevel

func GetConfiguredLevel() Level

GetConfiguredLevel get configured Level

func LevelFromString

func LevelFromString(str string) Level

LevelFromString convert string to Level if convert failed then return LevelInfo

type TrLogger

type TrLogger struct {
	// contains filtered or unexported fields
}

func DefaultTrLogger

func DefaultTrLogger() *TrLogger

func NewTrLogger

func NewTrLogger(level string, timestampFormat string, out io.Writer) *TrLogger

func (*TrLogger) Debug

func (dl *TrLogger) Debug(ctx context.Context, args ...any)

func (*TrLogger) Debugf

func (dl *TrLogger) Debugf(ctx context.Context, format string, args ...any)

func (*TrLogger) Debugln

func (dl *TrLogger) Debugln(ctx context.Context, args ...any)

func (*TrLogger) Error

func (dl *TrLogger) Error(ctx context.Context, args ...any)

func (*TrLogger) Errorf

func (dl *TrLogger) Errorf(ctx context.Context, format string, args ...any)

func (*TrLogger) Errorln

func (dl *TrLogger) Errorln(ctx context.Context, args ...any)

func (*TrLogger) Fatal

func (dl *TrLogger) Fatal(ctx context.Context, args ...any)

func (*TrLogger) Fatalf

func (dl *TrLogger) Fatalf(ctx context.Context, format string, args ...any)

func (*TrLogger) Fatalln

func (dl *TrLogger) Fatalln(ctx context.Context, args ...any)

func (*TrLogger) Info

func (dl *TrLogger) Info(ctx context.Context, args ...any)

func (*TrLogger) Infof

func (dl *TrLogger) Infof(ctx context.Context, format string, args ...any)

func (*TrLogger) Infoln

func (dl *TrLogger) Infoln(ctx context.Context, args ...any)

func (*TrLogger) Panic

func (dl *TrLogger) Panic(ctx context.Context, args ...any)

func (*TrLogger) Panicf

func (dl *TrLogger) Panicf(ctx context.Context, format string, args ...any)

func (*TrLogger) Panicln

func (dl *TrLogger) Panicln(ctx context.Context, args ...any)

func (*TrLogger) SetLevel

func (dl *TrLogger) SetLevel(level string)

func (*TrLogger) Warn

func (dl *TrLogger) Warn(ctx context.Context, args ...any)

func (*TrLogger) Warnf

func (dl *TrLogger) Warnf(ctx context.Context, format string, args ...any)

func (*TrLogger) Warnln

func (dl *TrLogger) Warnln(ctx context.Context, args ...any)

Jump to

Keyboard shortcuts

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