From c18e5071f6d073f701dd45b31e481f2bac8ec0d8 Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Tue, 6 May 2025 14:33:54 +0200 Subject: Failover + Log: Small slog fixes --- internal/failover/monitor.go | 2 +- internal/log/log.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/failover/monitor.go b/internal/failover/monitor.go index 5efdbd0..0d319d6 100644 --- a/internal/failover/monitor.go +++ b/internal/failover/monitor.go @@ -88,7 +88,7 @@ func (m *DroppedConMon) Start(ctx context.Context, gateway string, mtuSize int) defer ticker.Stop() // Otherwise send n pings, without waiting for pong and then check if dropped - slog.Debug("Failover started by sending pings and not waiting for a pong...") + slog.Debug("Failover started by sending pings and not waiting for a pong...") // Loop until the max drop counter // We begin with 2 as this is used as the sequence number for ping // and we have already sent a ping diff --git a/internal/log/log.go b/internal/log/log.go index d4a9bf5..47cdcf3 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -13,6 +13,9 @@ import ( // Init initializes the logger by setting a max level 'level' and a directory 'directory' where the log should be stored // internally, it uses slog, so any package just imports slog +// This can be done as this function sets the logger as the default logger in slog +// It returns the log file and the error +// This log file should be closed at the end func Init(lvl slog.Level, dir string) (*os.File, error) { err := util.EnsureDirectory(dir) if err != nil { -- cgit v1.2.3