fixed logs and config locations, updated connection closure handling

This commit is contained in:
2025-12-10 11:22:09 +01:00
parent 709abb30fa
commit 27609dba2b
7 changed files with 75 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ package logger
import (
"context"
"fmt"
"homestead/homestead_gateway/util"
"homestead/homestead_gateway/util/config"
"log/slog"
"os"
@@ -23,6 +24,7 @@ func New(id string, cfg config.LogConfig) (*slog.Logger, func() error, error) {
cfg.Rotation = 7
}
cfg.Directory = util.NormalizeLogPath(cfg.Directory)
console := slog.NewTextHandler(&prefixWriter{inner: os.Stderr, prefix: []byte("[" + id + "] "), startLine: true}, &slog.HandlerOptions{AddSource: true, Level: cfg.Level})
router := newFileRouter(cfg.Directory, cfg.Rotation, id)
root := slogmulti.Fanout(console, router)