logging

package
v0.44.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 2 modules, 1 package

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 (
	LogFormatJSON    = "json"
	LogFormatConsole = "console"
)

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context, opts ...Option) (context.Context, error)

Init creates a new zap logger and attaches it to the provided context.

func InitWithCore added in v0.17.0

func InitWithCore(ctx context.Context, buildCore func(zap.Config) zapcore.Core, opts ...Option) (context.Context, error)

InitWithCore creates a new zap logger and tees an additional core onto it. buildCore receives the logger config so the extra core uses the same level filtering and encoder settings as Init.

func NormalizeLogLevel added in v0.8.30

func NormalizeLogLevel(level string) (string, error)

func ParseLogLevel added in v0.8.30

func ParseLogLevel(level string) (zapcore.Level, error)

func SetLogLevel added in v0.8.30

func SetLogLevel(level string) error

SetLogLevel sets the log level for the active logger. Currently only used by lambda connectors.

Types

type Option added in v0.1.0

type Option func(*zap.Config)

func WithInitialFields added in v0.2.41

func WithInitialFields(fields map[string]interface{}) Option

WithInitialFields allows the logger to be configured with static fields at creation time. This is useful for setting fields that are constant across all log messages.

func WithLogFormat added in v0.1.0

func WithLogFormat(format string) Option

func WithLogLevel added in v0.1.0

func WithLogLevel(level string) Option

func WithOutputPaths added in v0.1.0

func WithOutputPaths(paths []string) Option

Jump to

Keyboard shortcuts

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