log

package
v0.0.0-...-bc13906 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FieldCorrelationID = "cid"
	FieldError         = "error"
	FieldLogHeader     = "log_header"
)
View Source
const (
	LevelDebug = "DEBUG"
	LevelInfo  = "INFO"
	LevelWarn  = "WARN"
	LevelError = "ERROR"
	LevelPanic = "PANIC"
	LevelFatal = "FATAL"
)

Variables

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

A Logger provides fast, leveled, structured logging. All methods are safe for concurrent use, along with filter policy to synthesis logging data.

func NewLog

func NewLog(name string, options ...Option) *Logger

NewLog create a new logger instance with default Zap logging production config and a logging scope based on the given name parameter. Custom logging option enables filter policy, correlationID and other configuration for logger. Logging is enabled at Info Level and above.

For further logging function. please refer to: https://pkg.go.dev/go.uber.org/zap

Example: Create a new logger with name "tenant-service", and filter policy to redact value from "email" fields. logger.NewLog("tenant-service", logger.WithFilters(filter.Field("email")))

func (*Logger) Debug

func (l *Logger) Debug(i ...interface{})

func (*Logger) Debugf

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

func (*Logger) Debugj

func (l *Logger) Debugj(j echoLog.JSON)

func (*Logger) Error

func (l *Logger) Error(i ...interface{})

func (*Logger) Errorf

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

func (*Logger) Errorj

func (l *Logger) Errorj(j echoLog.JSON)

func (*Logger) Fatal

func (l *Logger) Fatal(i ...interface{})

func (*Logger) Fatalf

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

func (*Logger) Fatalj

func (l *Logger) Fatalj(j echoLog.JSON)

func (*Logger) FromContext

func (l *Logger) FromContext(ctx echo.Context) *Logger

func (*Logger) GetCid

func (l *Logger) GetCid() string

func (*Logger) Info

func (l *Logger) Info(i ...interface{})

func (*Logger) Infof

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

func (*Logger) Infoj

func (l *Logger) Infoj(j echoLog.JSON)

func (*Logger) Level

func (l *Logger) Level() echoLog.Lvl

func (*Logger) Output

func (l *Logger) Output() io.Writer

func (*Logger) Panic

func (l *Logger) Panic(i ...interface{})

func (*Logger) Panicf

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

func (*Logger) Panicj

func (l *Logger) Panicj(j echoLog.JSON)

func (*Logger) Prefix

func (l *Logger) Prefix() string

func (*Logger) Print

func (l *Logger) Print(i ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

func (*Logger) Printj

func (l *Logger) Printj(j echoLog.JSON)

func (*Logger) SetHeader

func (l *Logger) SetHeader(h string)

func (*Logger) SetLevel

func (l *Logger) SetLevel(v echoLog.Lvl)

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(p string)

func (*Logger) Warn

func (l *Logger) Warn(i ...interface{})

func (*Logger) Warnf

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

func (*Logger) Warnj

func (l *Logger) Warnj(j echoLog.JSON)

func (*Logger) WithCid

func (l *Logger) WithCid(cid string) *Logger

func (*Logger) WithErr

func (l *Logger) WithErr(err error) *Logger

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]any) *Logger

func (*Logger) WithLogger

func (l *Logger) WithLogger(ctx echo.Context) echo.Context

type Option

type Option func(*Logger)

func WithCid

func WithCid(cid string) Option

func WithDevelopment

func WithDevelopment(isDevelop bool) Option

func WithDurationEncoder

func WithDurationEncoder(encoder zapcore.DurationEncoder) Option

func WithLevel

func WithLevel(level string) Option

func WithTimeEncoder

func WithTimeEncoder(encoder zapcore.TimeEncoder) Option

Jump to

Keyboard shortcuts

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