logger

package
v0.0.0-...-9cf7771 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerTraceKey = "logid"

	LogLevelFlagFatal LogLevelFlag = 1
	LogLevelFlagPanic LogLevelFlag = 2
	LogLevelFlagError LogLevelFlag = 3
	LogLevelFlagWarn  LogLevelFlag = 4
	LogLevelFlagInfo  LogLevelFlag = 5
	LogLevelFlagDebug LogLevelFlag = 6

	LogLevelFatal LogLevel = "FATAL"
	LogLevelPanic LogLevel = "PANIC"
	LogLevelError LogLevel = "ERROR"
	LogLevelWarn  LogLevel = "WARN"
	LogLevelInfo  LogLevel = "INFO"
	LogLevelDebug LogLevel = "DEBUG"
)

Variables

This section is empty.

Functions

func GetTraceIDWithGinContext

func GetTraceIDWithGinContext(ctx *gin.Context) string

func InitLogger

func InitLogger(conf Config) error

func NewOutgoingContextWithGinContext

func NewOutgoingContextWithGinContext(ctx *gin.Context) context.Context

func NewOutgoingContextWithIncomingContext

func NewOutgoingContextWithIncomingContext(ctx context.Context) context.Context

func NewTraceID

func NewTraceID() string

func SetLevel

func SetLevel(level LogLevel) error

Types

type Config

type Config struct {
	Level   LogLevel
	Output  string
	MaxSize int
}

type LogLevel

type LogLevel string

type LogLevelFlag

type LogLevelFlag int

type Logger

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

func NewLogger

func NewLogger() *Logger

func NewLoggerWithContext

func NewLoggerWithContext(ctx context.Context) *Logger

func NewLoggerWithGinContext

func NewLoggerWithGinContext(ctx *gin.Context) *Logger

func NewLoggerWithTraceID

func NewLoggerWithTraceID(traceID string) *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

func (*Logger) GetTraceID

func (l *Logger) GetTraceID() string

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Panicf

func (l *Logger) Panicf(format string, v ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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