This is a logger library that uses slog to implement the Hertz logger interface
Download and install it:
go get github.com/hertz-contrib/logger/slog
Import it in your code:
import hertzslog "github.com/hertz-contrib/logger/slog"
Simple Example:
package main
import (
"context"
"github.com/cloudwego/hertz/pkg/common/hlog"
hertzslog "github.com/hertz-contrib/logger/slog"
)
func main() {
logger := hertzslog.NewLogger()
hlog.SetLogger(logger)
...
hlog.CtxInfof(context.Background(), "hello %s", "hertz")
}