don't trim leading slash on callers outside cwd (#266)
Fixes https://github.com/rs/zerolog/issues/265
This commit is contained in:
parent
9336c4d0ed
commit
cac3894be4
|
@ -358,8 +358,8 @@ func consoleDefaultFormatCaller(noColor bool) Formatter {
|
|||
if len(c) > 0 {
|
||||
cwd, err := os.Getwd()
|
||||
if err == nil {
|
||||
c = strings.TrimPrefix(c, cwd)
|
||||
c = strings.TrimPrefix(c, "/")
|
||||
prefix := cwd + "/"
|
||||
c = strings.TrimPrefix(c, prefix)
|
||||
}
|
||||
c = colorize(c, colorBold, noColor) + colorize(" >", colorCyan, noColor)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue