logs

package
v0.0.0-...-271e206 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxDebug

func CtxDebug(ctx context.Context, format string, v ...interface{})

func CtxError

func CtxError(ctx context.Context, format string, v ...interface{})

func CtxFatal

func CtxFatal(ctx context.Context, format string, v ...interface{})

func CtxInfo

func CtxInfo(ctx context.Context, format string, v ...interface{})

func CtxWarn

func CtxWarn(ctx context.Context, format string, v ...interface{})

func Debug

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

func Error

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

func Fatal

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

func GetLogID

func GetLogID(ctx context.Context) string

func Info

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

func NewLogID

func NewLogID() string

func SetLogID

func SetLogID(ctx context.Context, logID string) context.Context

func SetLogLevel

func SetLogLevel(level LogLevel)

SetLogLevel sets the level of logs below which logs will not be output. The default log level is LevelInfo. Note that this method is not concurrent-safe.

func SetLogger

func SetLogger(l Logger)

SetLogger sets the logger. Note that this method is not concurrent-safe.

func Warn

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

Types

type LogIDProvider

type LogIDProvider interface {
	GetLogID(ctx context.Context) string
	SetLogID(ctx context.Context, logID string) context.Context
	NewLogID() string
}

type LogLevel

type LogLevel int

LogLevel Log Level

const (
	DebugLevel LogLevel = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

type Logger

type Logger interface {
	LogIDProvider

	SetLevel(level LogLevel)
	GetLevel() LogLevel

	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
	Fatal(format string, v ...interface{})

	CtxDebug(ctx context.Context, format string, v ...interface{})
	CtxInfo(ctx context.Context, format string, v ...interface{})
	CtxWarn(ctx context.Context, format string, v ...interface{})
	CtxError(ctx context.Context, format string, v ...interface{})
	CtxFatal(ctx context.Context, format string, v ...interface{})

	Flush()
}

Logger Interface for logging

func DefaultLogger

func DefaultLogger() Logger

Jump to

Keyboard shortcuts

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