logging

package
v0.0.0-...-d4a0ffb Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package logging provides a command line flag for configuring the logging output format for Go's structured logging.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TypeNone just discards all log output.
	TypeNone = &noneType{}

	// TypeStdout writes log output to stdout.
	TypeStdout = &stdoutType{}

	// TypeSyslog writes log output to the Unix syslog, or sends it to
	// a remote syslog server.
	TypeSyslog = &syslogType{}
)

Functions

This section is empty.

Types

type Spec

type Spec struct {
	Type Type
	Arg  string
}

Spec is the parsed form of the --logging command line flag, consisting of the logging type, plus an optional string argument for instantiating the `slog.Handler`.

func RegisterFlag

func RegisterFlag() *Spec

RegisterFlag registers the --logging flag, and returns a `Spec` that will be populated at flag parsing time.

func (*Spec) MakeLogger

func (s *Spec) MakeLogger() (*slog.Logger, error)

MakeLogger instantiates an `slog.Logger` based on the logging Spec.

type Type

type Type interface {
	// contains filtered or unexported methods
}

Type represents a type of logging output, and is used to instantiate a `slog.Handler` for writing logging output.

Jump to

Keyboard shortcuts

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