fix(log): write each log category to its own file (#2206)

Previously, `makeLogHandler()` hardcoded "standard" as the logfile name
passed to `getLogWriter()`, causing all log categories (`database`,
`http`, `events`, `mail`) to write to `standard.log` instead of their
own files.

Add a logfile parameter to `makeLogHandler()` so each caller specifies
its category name, producing `database.log`, `http.log`, `echo.log`,
`events.log`, and `mail.log` as expected.

Fixes https://github.com/go-vikunja/vikunja/issues/2177
This commit is contained in:
kolaente
2026-02-08 16:22:58 +01:00
committed by GitHub
parent b6974ffcfd
commit 0e05d1cc9d
6 changed files with 35 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ type MailLogger struct {
// NewMailLogger creates and initializes a new mail logger
func NewMailLogger(configLogEnabled bool, configLogMail string, configLogMailLevel string, configLogFormat string) maillog.Logger {
handler := makeLogHandler(configLogEnabled, configLogMail, configLogMailLevel, configLogFormat)
handler := makeLogHandler(configLogEnabled, configLogMail, "mail", configLogMailLevel, configLogFormat)
mailLogger := &MailLogger{
logger: slog.New(handler).With("component", "mail"),