log

package
v2.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 3 modules, 43 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

This section is empty.

Variables

This section is empty.

Functions

func Hex

func Hex(k string, d []byte) zap.Field

Hex creates a zap field which convert binary to hex.

func InitLoggers

func InitLoggers(globalCfg GlobalConfig, subCfgs map[string]GlobalConfig, opts ...zap.Option) error

InitLoggers initializes the global logger and other sub loggers.

func L

func L() *zap.Logger

L wraps zap.L().

func Logger

func Logger(name string) *zap.Logger

Logger returns logger of the given name

func RegisterLevelConfigMux

func RegisterLevelConfigMux(root *http.ServeMux)

RegisterLevelConfigMux registers log's level config http mux.

func S

func S() *zap.SugaredLogger

S wraps zap.S().

func T

T is a wrapper of otelzap.Ctx, returns a logger with context.

Types

type GlobalConfig

type GlobalConfig struct {
	Zap                *zap.Config  `json:"zap" yaml:"zap"`
	Trace              *TraceConfig `json:"trace" yaml:"trace"`
	StderrRedirectFile *string      `json:"stderrRedirectFile" yaml:"stderrRedirectFile"`
	RedirectStdLog     bool         `json:"stdLogRedirect" yaml:"stdLogRedirect"`
	EcsIntegration     bool         `json:"ecsIntegration" yaml:"ecsIntegration"`
}

GlobalConfig defines the global logger configurations.

type TraceConfig

type TraceConfig struct {
	MinLevel         string `json:"minLevel" yaml:"minLevel"`
	ErrorStatusLevel string `json:"errorStatusLevel" yaml:"errorStatusLevel"`
	Caller           bool   `json:"caller" yaml:"caller"`
	CallerDepth      int    `json:"callerDepth" yaml:"callerDepth"`
	StackTrace       bool   `json:"stackTrace" yaml:"stackTrace"`
	WithTraceID      bool   `json:"withTraceID" yaml:"withTraceID"`
}

TraceConfig defines the logger configurations for tracing.

Jump to

Keyboard shortcuts

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