We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f24720 commit 170b79cCopy full SHA for 170b79c
internal/logger/logger.go
@@ -11,6 +11,7 @@ import (
11
"log/slog"
12
"os"
13
"path"
14
+ "path/filepath"
15
"strconv"
16
"strings"
17
@@ -55,8 +56,9 @@ func New(logPath, level string) *slog.Logger {
55
56
if a.Key == slog.SourceKey {
57
source, ok := a.Value.Any().(*slog.Source)
58
if ok {
- relativeFilePath := strings.Split(source.File, "/agent/")[1]
59
- a.Value = slog.StringValue(relativeFilePath + ":" + strconv.Itoa(source.Line))
+ directory := filepath.Dir(source.File)
60
+ relativePath := path.Join(filepath.Base(directory), filepath.Base(source.File))
61
+ a.Value = slog.StringValue(relativePath + ":" + strconv.Itoa(source.Line))
62
}
63
64
0 commit comments