promlog

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package promlog defines standardised ways to initialize Go kit loggers across Prometheus components. It should typically only ever be imported by main packages.

Deprecated: This package has been deprecated in favor of migrating to `github.com/prometheus/common/promslog` which uses the Go standard library `log/slog` package.

Index

Constants

This section is empty.

Variables

View Source
var (
	LevelFlagOptions  = []string{"debug", "info", "warn", "error"}
	FormatFlagOptions = []string{"logfmt", "json"}
)

Functions

func New

func New(config *Config) log.Logger

New returns a new leveled oklog logger. Each logged line will be annotated with a timestamp. The output always goes to stderr.

func NewDynamic added in v0.26.0

func NewDynamic(config *Config) *logger

NewDynamic returns a new leveled logger. Each logged line will be annotated with a timestamp. The output always goes to stderr. Some properties can be changed, like the level.

func NewDynamicWithLogger added in v0.44.0

func NewDynamicWithLogger(l log.Logger, config *Config) *logger

NewDynamicWithLogger returns a new leveled logger with a custom io.Writer. Each logged line will be annotated with a timestamp. Some properties can be changed, like the level.

func NewWithLogger added in v0.44.0

func NewWithLogger(l log.Logger, config *Config) log.Logger

NewWithLogger returns a new leveled oklog logger with a custom log.Logger. Each logged line will be annotated with a timestamp.

Types

type AllowedFormat

type AllowedFormat struct {
	// contains filtered or unexported fields
}

AllowedFormat is a settable identifier for the output format that the logger can have.

func (*AllowedFormat) Set

func (f *AllowedFormat) Set(s string) error

Set updates the value of the allowed format.

func (*AllowedFormat) String

func (f *AllowedFormat) String() string