logging

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 5 Imported by: 0 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

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogger

func DefaultLogger() *zap.SugaredLogger

DefaultLogger returns the default logger for the package.

func FromContext

func FromContext(ctx context.Context) *zap.SugaredLogger

FromContext returns the logger stored in the context. If no such logger exists, a default logger is returned.

func NewLogger

func NewLogger(conf *Config) *zap.SugaredLogger

NewLogger creates a new logger with the given log level

func SetConfig

func SetConfig(c *Config)

SetConfig sets given logging configs for DefaultLogger's logger. Must set configs before calling DefaultLogger()

func SetLevel

func SetLevel(l zapcore.Level)

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger creates a new context with the provided logger attached.

Types

type Config

type Config struct {
	Encoding    string
	Level       zapcore.Level
	Development bool
}

Jump to

Keyboard shortcuts

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