log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package log configures the application-wide zap logger.

Format defaults to a colored console encoder when stderr is a TTY and to JSON otherwise (e.g. in CI). Both can be overridden via flags — see New.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) (*zap.Logger, error)

New builds a *zap.Logger from opts. The caller owns the logger and should defer logger.Sync().

Types

type Format

type Format string

Format selects the log encoder.

const (
	// FormatAuto picks console on a TTY, JSON otherwise.
	FormatAuto Format = "auto"
	// FormatConsole forces the colored console encoder.
	FormatConsole Format = "console"
	// FormatJSON forces the JSON encoder.
	FormatJSON Format = "json"
)

type Options

type Options struct {
	// Level is one of debug|info|warn|error.
	Level string
	// Format is auto|console|json.
	Format Format
}

Options controls logger construction.

Jump to

Keyboard shortcuts

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