Change time

This commit is contained in:
2025-02-22 21:33:37 -06:00
parent d2e07e98a5
commit c97d51c48f
2 changed files with 10 additions and 0 deletions

View File

@ -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]