Documentation ¶
Index ¶
- type Deduper
- func (d *Deduper) Debug(msg string, args ...any)
- func (d *Deduper) Enabled(ctx context.Context, level slog.Level) bool
- func (d *Deduper) Error(msg string, args ...any)
- func (d *Deduper) Handle(ctx context.Context, r slog.Record) error
- func (d *Deduper) Info(msg string, args ...any)
- func (d *Deduper) Stop()
- func (d *Deduper) Warn(msg string, args ...any)
- func (d *Deduper) WithAttrs(attrs []slog.Attr) slog.Handler
- func (d *Deduper) WithGroup(name string) slog.Handler
- type JSONFileLogger
- func (l *JSONFileLogger) Close() error
- func (l *JSONFileLogger) Debug(msg string, args ...any)
- func (l *JSONFileLogger) Error(msg string, args ...any)
- func (l *JSONFileLogger) Info(msg string, args ...any)
- func (l *JSONFileLogger) Warn(msg string, args ...any)
- func (l *JSONFileLogger) With(args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deduper ¶
type Deduper struct {
// contains filtered or unexported fields
}
Deduper implements *slog.Handler, dedupes log lines based on a time duration.
func (*Deduper) Debug ¶
Debug logs the provided message and key-value arguments using the Deduper's internal slog.Logger. It is simply a wrapper around slog.Logger.Debug().
func (*Deduper) Enabled ¶ added in v0.300.0
Enabled returns true if the Deduper's internal slog.Logger is enabled at the provided context and log level, and returns false otherwise. It implements slog.Handler.
func (*Deduper) Error ¶
Error logs the provided message and key-value arguments using the Deduper's internal slog.Logger. It is simply a wrapper around slog.Logger.Error().
func (*Deduper) Handle ¶ added in v0.300.0
Handle uses the provided context and slog.Record to deduplicate messages every 1m. Log records received within the interval are not acted on, and thus dropped. Log records that pass deduplication and need action invoke the Handle() method on the Deduper's internal slog.Logger's handler, effectively chaining log calls to the internal slog.Logger.
func (*Deduper) Info ¶
Info logs the provided message and key-value arguments using the Deduper's internal slog.Logger. It is simply a wrapper around slog.Logger.Info().
func (*Deduper) Warn ¶
Warn logs the provided message and key-value arguments using the Deduper's internal slog.Logger. It is simply a wrapper around slog.Logger.Warn().
type JSONFileLogger ¶
type JSONFileLogger struct {
// contains filtered or unexported fields
}
JSONFileLogger represents a logger that writes JSON to a file. It implements the promql.QueryLogger interface.
func NewJSONFileLogger ¶
func NewJSONFileLogger(s string) (*JSONFileLogger, error)
NewJSONFileLogger returns a new JSONFileLogger.
func (*JSONFileLogger) Close ¶
func (l *JSONFileLogger) Close() error
Close closes the underlying file. It implements the promql.QueryLogger interface.
func (*JSONFileLogger) Debug ¶ added in v0.300.0
func (l *JSONFileLogger) Debug(msg string, args ...any)
Debug calls the `Debug()` method on the underlying `log/slog.Logger` with the provided msg and args. It implements the promql.QueryLogger interface.
func (*JSONFileLogger) Error ¶ added in v0.300.0
func (l *JSONFileLogger) Error(msg string, args ...any)
Error calls the `Error()` method on the underlying `log/slog.Logger` with the provided msg and args. It implements the promql.QueryLogger interface.
func (*JSONFileLogger) Info ¶ added in v0.300.0
func (l *JSONFileLogger) Info(msg string, args ...any)
Info calls the `Info()` method on the underlying `log/slog.Logger` with the provided msg and args. It implements the promql.QueryLogger interface.
func (*JSONFileLogger) Warn ¶ added in v0.300.0
func (l *JSONFileLogger) Warn(msg string, args ...any)
Warn calls the `Warn()` method on the underlying `log/slog.Logger` with the provided msg and args. It implements the promql.QueryLogger interface.
func (*JSONFileLogger) With ¶ added in v0.300.0
func (l *JSONFileLogger) With(args ...any)
With calls the `With()` method on the underlying `log/slog.Logger` with the provided msg and args. It implements the promql.QueryLogger interface.