wlog

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: LGPL-3.0 Imports: 8 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Error

func Error(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Info

func Info(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func NewLogger

func NewLogger(cfg *Config) *wrappedLogger

NewLogger is a function to create new zap logger this logger implement the Logger interface

func Panic

func Panic(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func SetGlobalLogger

func SetGlobalLogger(l Logger)

SetGlobalLogger is a function to replace global logger object

func Warn

func Warn(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func Wrapper

func Wrapper(l *zap.Logger) *wrappedLogger

Wrapper is a function to parse zap.Logger to Logger interface

Types

type Config

type Config struct {
	Name         string
	Level        Level
	File         string
	RotateConfig *RotateConfig
	Wrappers     []func(*zap.Logger) *zap.Logger
}

type Level

type Level uint
const (
	DebugLevel Level = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	PanicLevel
)

func ParseLevel

func ParseLevel(str string) Level

ParseLevel parse level string

type Logger

type Logger interface {
	With(fields ...zap.Field) Logger
	Debug(msg string, fields ...zap.Field)
	Info(msg string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Error(msg string, fields ...zap.Field)
	Panic(msg string, fields ...zap.Field)
}

Logger is the log interface

func With

func With(fields ...zap.Field) Logger

With is a function to return the Logger with some preset fields

type RotateConfig

type RotateConfig struct {
	Compress   bool
	MaxAge     int
	MaxSize    int
	MaxBackups int
}

RotateConfig config log rotate

Jump to

Keyboard shortcuts

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