Skip to content

Repository files navigation

logi

Go PKG

Log initializer for golang's slog. If terminal is detected, it will use colorized output else it will use JSON output.

go get github.com/rakunlabs/logi

Usage

logi.InitializeLog()

slog.Error("This is an error message")
slog.Info("Yet another log message")

For setting global log level, uses level parse from slog package.

logi.SetLogLevel("ERROR")

Context logging

ctx := logi.WithContext(context.Background(), slog.With(slog.String("component", "example")))

logi.Ctx(ctx).Info("This is a log message")

About

log adapter

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages