Help us shape the future of Go! Take the 2026 Go Developer Survey

logging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logging provides a shared logger constructor for all Mokka binaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(cfg Config) *zap.Logger

NewLogger returns a zap.Logger writing to stdout and installs it as the process-wide global logger (zap.L() / zap.S()).

Types

type Config

type Config struct {
	Level  Level
	Format Format
}

Config carries the two knobs that shape log output.

type Format

type Format string

Format is the log output encoding.

const (
	FormatJSON  Format = "json"
	FormatPlain Format = "plain"
)

Supported log formats.

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat maps a CLI/env string to a Format, defaulting to FormatJSON on empty input.

type Level

type Level string

Level is the log verbosity.

const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

Supported log levels.

func ParseLevel

func ParseLevel(s string) (Level, error)

ParseLevel maps a CLI/env string to a Level, defaulting to LevelInfo on empty input.

Jump to

Keyboard shortcuts

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