From 54ebf468e54c27f79cac47f58e93d6501057507b Mon Sep 17 00:00:00 2001 From: Youming Lin Date: Fri, 1 Mar 2024 18:50:13 -0600 Subject: [PATCH] doc: update readme to use os-specific path separator (#534) * update readme to use os-specific path separator * shorten getShortLineNo example to one liner --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index dc54997c..5b1ab730 100644 --- a/README.md +++ b/README.md @@ -412,15 +412,7 @@ Equivalent of `Lshortfile`: ```go zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string { - short := file - for i := len(file) - 1; i > 0; i-- { - if file[i] == '/' { - short = file[i+1:] - break - } - } - file = short - return file + ":" + strconv.Itoa(line) + return filepath.Base(file) + ":" + strconv.Itoa(line) } log.Logger = log.With().Caller().Logger() log.Info().Msg("hello world")