package main
import (
"log/slog"
plog "github.com/phuslu/log"
)
func main() {
plog.DefaultLogger = plog.Logger{
Level: plog.DebugLevel,
Caller: 1,
}
var logger *slog.Logger
logger = plog.DefaultLogger.Slog()
plog.Info().Msg("msg from phuslu/log")
logger.Info("info msg from slog")
logger.Error("error msg from slot")
}
Output:
{"time":"2023-09-06T15:36:41.406+08:00","level":"info","caller":"main.go:18","goid":1,"message":"msg from phuslu/log"}
{"time":"2023-09-06T15:36:41.406+08:00","caller":"logger_go1.21.go:30","goid":1,"message":"info msg from slog"}
{"time":"2023-09-06T15:36:41.406+08:00","caller":"logger_go1.21.go:30","goid":1,"message":"error msg from slot"}
And missing level when using log/slog, it would be great to have support for slog levels!
Hi!
Output:
And missing
level
when usinglog/slog
, it would be great to have support for slog levels!