cleanup paths
This commit is contained in:
parent
307ff646e0
commit
113dc5451a
1 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue