diff --git a/README.md b/README.md index bbb6422..02bb58d 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ Attributes will be injected in log payload. Attributes added to records are not accepted. +Other global parameters: + +```go +slogloki.LogLevels = map[slog.Level]promtail.LogLevel{...} +``` + ### Example ```go diff --git a/handler.go b/handler.go index a39bba8..cad7cfe 100644 --- a/handler.go +++ b/handler.go @@ -34,7 +34,7 @@ func (o Option) NewLokiHandler() slog.Handler { } clients := map[slog.Level]promtail.Client{} - for k, v := range logLevelConverter { + for k, v := range LogLevels { conf := promtail.ClientConfig{ PushURL: o.Endpoint, BatchWait: o.BatchWait, diff --git a/loki.go b/loki.go index c768a5b..1d7026f 100644 --- a/loki.go +++ b/loki.go @@ -6,7 +6,7 @@ import ( "github.com/afiskon/promtail-client/promtail" ) -var logLevelConverter = map[slog.Level]promtail.LogLevel{ +var LogLevels = map[slog.Level]promtail.LogLevel{ slog.LevelDebug: promtail.DEBUG, slog.LevelInfo: promtail.INFO, slog.LevelWarn: promtail.WARN,