...

Package promlog

import "github.com/prometheus/common/promlog"
Overview
Index
Subdirectories

Overview ▾

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

Variables

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

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

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

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

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.

type AllowedFormat

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

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

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

type AllowedLevel

AllowedLevel is a settable identifier for the minimum level a log entry must be have.

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

func (*AllowedLevel) Set

func (l *AllowedLevel) Set(s string) error

Set updates the value of the allowed level.

func (*AllowedLevel) String

func (l *AllowedLevel) String() string

func (*AllowedLevel) UnmarshalYAML

func (l *AllowedLevel) UnmarshalYAML(unmarshal func(interface{}) error) error

type Config

Config is a struct containing configurable settings for the logger

type Config struct {
    Level  *AllowedLevel
    Format *AllowedFormat
}

Subdirectories

Name Synopsis
..
flag