Documentation ¶
Index ¶
- Constants
- Variables
- type Logger
- func (l *Logger) Debug(i ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Debugj(j echoLog.JSON)
- func (l *Logger) Error(i ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorj(j echoLog.JSON)
- func (l *Logger) Fatal(i ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalj(j echoLog.JSON)
- func (l *Logger) FromContext(ctx echo.Context) *Logger
- func (l *Logger) GetCid() string
- func (l *Logger) Info(i ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoj(j echoLog.JSON)
- func (l *Logger) Level() echoLog.Lvl
- func (l *Logger) Output() io.Writer
- func (l *Logger) Panic(i ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Panicj(j echoLog.JSON)
- func (l *Logger) Prefix() string
- func (l *Logger) Print(i ...interface{})
- func (l *Logger) Printf(format string, args ...interface{})
- func (l *Logger) Printj(j echoLog.JSON)
- func (l *Logger) SetHeader(h string)
- func (l *Logger) SetLevel(v echoLog.Lvl)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetPrefix(p string)
- func (l *Logger) Warn(i ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Warnj(j echoLog.JSON)
- func (l *Logger) WithCid(cid string) *Logger
- func (l *Logger) WithErr(err error) *Logger
- func (l *Logger) WithFields(fields map[string]any) *Logger
- func (l *Logger) WithLogger(ctx echo.Context) echo.Context
- type Option
Constants ¶
const ( FieldCorrelationID = "cid" FieldError = "error" FieldLogHeader = "log_header" )
const ( LevelDebug = "DEBUG" LevelInfo = "INFO" LevelWarn = "WARN" LevelError = "ERROR" LevelPanic = "PANIC" LevelFatal = "FATAL" )
Variables ¶
var Levels = map[string]zapcore.Level{ LevelDebug: zapcore.DebugLevel, LevelInfo: zapcore.InfoLevel, LevelWarn: zapcore.WarnLevel, LevelError: zapcore.ErrorLevel, LevelPanic: zapcore.PanicLevel, LevelFatal: zapcore.FatalLevel, }
Functions ¶
This section is empty.
Types ¶
type Logger ¶
A Logger provides fast, leveled, structured logging. All methods are safe for concurrent use, along with filter policy to synthesis logging data.
func NewLog ¶
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) FromContext ¶
func (*Logger) WithLogger ¶
func (l *Logger) WithLogger(ctx echo.Context) echo.Context
type Option ¶
type Option func(*Logger)
func WithDevelopment ¶
func WithDurationEncoder ¶
func WithDurationEncoder(encoder zapcore.DurationEncoder) Option
func WithTimeEncoder ¶
func WithTimeEncoder(encoder zapcore.TimeEncoder) Option