package promslog
import "github.com/prometheus/common/promslog"
Index ¶
- Variables
- func New(config *Config) *slog.Logger
- func NewNopLogger() *slog.Logger
- type Config
- type Format
- type Level
- func NewLevel() *Level
- func (l *Level) Set(s string) error
- func (l *Level) String() string
- func (l *Level) UnmarshalYAML(unmarshal func(interface{}) error) error
- type LogStyle
Variables ¶
var ( // LevelFlagOptions represents allowed logging levels. LevelFlagOptions = []string{"debug", "info", "warn", "error"} // FormatFlagOptions represents allowed formats. FormatFlagOptions = []string{"logfmt", "json"} )
Functions ¶
func New ¶
New returns a new slog.Logger. Each logged line will be annotated with a timestamp. The output always goes to stderr.
func NewNopLogger ¶
NewNopLogger is a convenience function to return an slog.Logger that writes to io.Discard.
Types ¶
type Config ¶
Config is a struct containing configurable settings for the logger
type Format ¶
type Format struct {
// contains filtered or unexported fields
}
Format controls a logging output format. Not concurrency-safe.
func NewFormat ¶
func NewFormat() *Format
NewFormat creates a new Format.
func (*Format) Set ¶
Set updates the value of the allowed format.
func (*Format) String ¶
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
Level controls a logging level, with an info default. It wraps slog.LevelVar with string-based level control. Level is safe to be used concurrently.
func NewLevel ¶
func NewLevel() *Level
NewLevel returns a new Level.
func (*Level) Set ¶
Set updates the logging level with the validation.
func (*Level) String ¶
String returns the current level.
func (*Level) UnmarshalYAML ¶
type LogStyle ¶
type LogStyle string
LogStyle represents the common logging formats in the Prometheus ecosystem.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
promslog/flag |
- Version
- v0.63.0 (latest)
- Published
- Mar 13, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 2 hours ago –
Tools for package owners.