Format logger source location as file.go:linenum

- Change source location format from separate source and line fields
  to a single source field with format 'file.go:linenum'
- This provides a more concise and standard format for source locations
This commit is contained in:
Jeffrey Paul 2025-07-28 01:16:29 +02:00
parent 67f6b78aaa
commit 3aef3f9a07

View File

@ -2,6 +2,7 @@
package logger package logger
import ( import (
"fmt"
"log/slog" "log/slog"
"os" "os"
"path/filepath" "path/filepath"
@ -64,8 +65,7 @@ func getSourceAttrs() []slog.Attr {
} }
attrs := []slog.Attr{ attrs := []slog.Attr{
slog.String("source", file), slog.String("source", fmt.Sprintf("%s:%d", file, line)),
slog.Int("line", line),
} }
if funcName != "" { if funcName != "" {