cleanup paths

This commit is contained in:
Amarpreet Minhas 2024-09-23 20:33:18 -04:00
parent 307ff646e0
commit 113dc5451a

View file

@ -1,8 +1,11 @@
package gologger package gologger
import ( import (
"fmt"
"io" "io"
"os" "os"
"runtime"
"strings"
"sync" "sync"
"time" "time"
@ -20,6 +23,12 @@ func Get(l string) zerolog.Logger {
var output io.Writer = zerolog.ConsoleWriter{ var output io.Writer = zerolog.ConsoleWriter{
Out: os.Stdout, Out: os.Stdout,
TimeFormat: time.RFC3339, TimeFormat: time.RFC3339,
FormatCaller: func(i interface{}) string {
_, vpath, _, _ := runtime.Caller(0)
bpath, _, _ := strings.Cut(vpath, "vendor/")
_, ret, _ := strings.Cut(fmt.Sprintf("%s", i), bpath)
return ret
},
} }
level, err := zerolog.ParseLevel(l) level, err := zerolog.ParseLevel(l)
if err != nil { if err != nil {