Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ Level: LevelDefault, Format: FormatDefault, }
DefaultOptions holds defaults for creating a Logger.
Functions ¶
This section is empty.
Types ¶
type EnabledAware ¶ added in v0.38.0
type Format ¶
type Format string
Format represents a text format to use when writing logs.
const ( FormatLogfmt Format = "logfmt" FormatJSON Format = "json" FormatDefault = FormatLogfmt )
Supported log formats.
func (Format) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Format) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Level ¶
type Level string
Level represents how verbose logging should be.
const ( LevelDebug Level = "debug" LevelInfo Level = "info" LevelWarn Level = "warn" LevelError Level = "error" LevelDefault = LevelInfo )
Supported log levels
func (Level) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Level) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the logging subsystem of Flow. It supports being dynamically updated at runtime.
func NewDeferred ¶ added in v0.40.0
NewDeferred creates a new logger with the default log level and format. The logger is not updated during initialization.
func (*Logger) Handler ¶ added in v0.37.0
Handler returns a slog.Handler. The returned Handler remains valid if l is updated.
type Options ¶
type Options struct { Level Level `river:"level,attr,optional"` Format Format `river:"format,attr,optional"` WriteTo []loki.LogsReceiver `river:"write_to,attr,optional"` }
Options is a set of options used to construct and configure a Logger.
func (*Options) SetToDefault ¶ added in v0.35.0
func (o *Options) SetToDefault()
SetToDefault implements river.Defaulter.