fixed logs and config locations, updated connection closure handling
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user