Change time
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -31,6 +32,9 @@ func Init(writer string) {
|
||||
slogOptions := &slog.HandlerOptions{
|
||||
Level: &L.SLogLevel,
|
||||
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
|
||||
if a.Key == slog.TimeKey {
|
||||
a.Value = slog.StringValue(a.Value.Time().Format(time.DateTime))
|
||||
}
|
||||
if a.Key == slog.LevelKey {
|
||||
level := a.Value.Any().(slog.Level)
|
||||
levelLabel, exists := LevelNames[level]
|
||||
|
Reference in New Issue
Block a user