Skip to content

rakunlabs/logi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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")