Documentation ΒΆ
Index ΒΆ
- Variables
- func DefaultConverter(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, ...) model.LabelSet
- type Converter
- type DataConverterOpt
- func DataConverterDataKeyOpt(key string) DataConverterOpt
- func DataConverterErrorKeyOpt(keys ...string) DataConverterOpt
- func DataConverterExemptDataPrefixOpt(prefix string) DataConverterOpt
- func DataConverterSourceKeyOpt(key string) DataConverterOpt
- func DataConverterUseImpliedOpt() DataConverterOpt
- func DataConveterSetExemptKeys(keys ...string) DataConverterOpt
- type DataConverterOpts
- type LokiHandler
- type Option
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var AttributeKeyInvalidCharReplacement = "_"
View Source
var ErrorKeys = []string{"error", "err"}
View Source
var SourceKey = "source"
View Source
var SubAttributeSeparator = "__"
See:
Functions ΒΆ
Types ΒΆ
type Converter ΒΆ
type Converter func(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, loggerAttr []slog.Attr, groups []string, record *slog.Record) model.LabelSet
func NewDataConverter ΒΆ
func NewDataConverter(dataPrefix string, opts ...DataConverterOpt) Converter
type DataConverterOpt ΒΆ
type DataConverterOpt func(*DataConverterOpts)
func DataConverterDataKeyOpt ΒΆ
func DataConverterDataKeyOpt(key string) DataConverterOpt
func DataConverterErrorKeyOpt ΒΆ
func DataConverterErrorKeyOpt(keys ...string) DataConverterOpt
func DataConverterExemptDataPrefixOpt ΒΆ
func DataConverterExemptDataPrefixOpt(prefix string) DataConverterOpt
func DataConverterSourceKeyOpt ΒΆ
func DataConverterSourceKeyOpt(key string) DataConverterOpt
func DataConverterUseImpliedOpt ΒΆ
func DataConverterUseImpliedOpt() DataConverterOpt
func DataConveterSetExemptKeys ΒΆ
func DataConveterSetExemptKeys(keys ...string) DataConverterOpt
type DataConverterOpts ΒΆ
type DataConverterOpts struct { ErrorKeys []string SourceKey string DataKey string ExemptDataPrefix string ExemptKeys []string UseImplied bool }
func DefaultDataConverterOpts ΒΆ
func DefaultDataConverterOpts() *DataConverterOpts
type LokiHandler ΒΆ
type LokiHandler struct {
// contains filtered or unexported fields
}
type Option ΒΆ
type Option struct { // log level (default: debug) Level slog.Leveler // loki Client *loki.Client // optional: customize webhook event builder Converter Converter // optional: fetch attributes from context AttrFromContext []func(ctx context.Context) []slog.Attr // optional: see slog.HandlerOptions AddSource bool ReplaceAttr func(groups []string, a slog.Attr) slog.Attr }
func (Option) NewLokiHandler ΒΆ
Creating a Loki client at each `NewLokiHandler` call may lead to connection leak when chaining many operations: `logger.With(...).With(...).With(...).With(...)`
Click to show internal directories.
Click to hide internal directories.