通道的增删接口实现,数据表和目录结构调整
This commit is contained in:
26
pkg/logs/logs.go
Normal file
26
pkg/logs/logs.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package logs
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"platform/pkg/env"
|
||||
"time"
|
||||
|
||||
"github.com/lmittmann/tint"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
slog.SetDefault(slog.New(
|
||||
tint.NewHandler(os.Stdout, &tint.Options{
|
||||
Level: env.LogLevel,
|
||||
TimeFormat: time.Kitchen,
|
||||
ReplaceAttr: func(_ []string, attr slog.Attr) slog.Attr {
|
||||
err, ok := attr.Value.Any().(error)
|
||||
if ok {
|
||||
return tint.Err(err)
|
||||
}
|
||||
return attr
|
||||
},
|
||||
}),
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user