From 6626c8846b6bfa79e9850f738b1aa621f6e6ab90 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Thu, 3 Oct 2024 19:07:07 +0200 Subject: [PATCH] log: fix level for transfer logs Signed-off-by: Nicola Murino --- internal/logger/logger.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/logger/logger.go b/internal/logger/logger.go index fd535496..853c7f09 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -205,7 +205,13 @@ func ErrorToConsole(format string, v ...any) { func TransferLog(operation, path string, elapsed int64, size int64, user, connectionID, protocol, localAddr, remoteAddr, ftpMode string, err error, ) { - ev := logger.Info(). + var ev *zerolog.Event + if err != nil { + ev = logger.Error() + } else { + ev = logger.Info() + } + ev. Timestamp(). Str("sender", operation). Str("local_addr", localAddr).