log

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultLogLevel = "info"
	DefaultLogFile  = "stdout"
)

Variables

View Source
var DefaultZapLoggerConfig = zap.Config{
	Level:       zap.NewAtomicLevelAt(zapcore.InfoLevel),
	Development: false,
	Sampling: &zap.SamplingConfig{
		Initial:    100,
		Thereafter: 100,
	},
	Encoding: "console",
	EncoderConfig: zapcore.EncoderConfig{
		TimeKey:        "ts",
		LevelKey:       "level",
		NameKey:        "logger",
		CallerKey:      "caller",
		MessageKey:     "msg",
		StacktraceKey:  "stacktrace",
		LineEnding:     zapcore.DefaultLineEnding,
		EncodeLevel:    zapcore.LowercaseLevelEncoder,
		EncodeTime:     zapcore.ISO8601TimeEncoder,
		EncodeDuration: zapcore.StringDurationEncoder,
		EncodeCaller:   zapcore.ShortCallerEncoder,
	},
	OutputPaths:      []string{"stdout"},
	ErrorOutputPaths: []string{"stdout"},
}

DefaultZapLoggerConfig defines default zap logger configuration.

Functions

func Debug

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

func Error

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

func Fatal

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

func GetLevel

func GetLevel() zapcore.Level

func GetLogger

func GetLogger() *zap.Logger

func GetLoggerConfig

func GetLoggerConfig() *zap.Config

func Info

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

func InitGlobalLogger

func InitGlobalLogger(cfg *Config) (*zap.Logger, error)

InitGlobalLogger initializes the global logger with Config.

func Panic

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

func SetLevel

func SetLevel(lvl string) error

func Warn

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

func With

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

Types

type Config

type Config struct {
	Level string `toml:"level" env:"LEVEL"`
	File  string
}

Jump to

Keyboard shortcuts

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