ziflex / lecho

Zerolog wrapper for Echo framework 🍅
MIT License
98 stars 11 forks source link

Echo uses lecho and log level is missing, can we check and override ? #33

Open iangregsondev opened 1 day ago

iangregsondev commented 1 day ago

Hi,

I have the following output, there is message that comes from ECHO but using lecho logger, it is missing the LEVEL and displays ??? instead of log level.

Is there anyway to intercept it and check if the level is actually empty? If it is, then change to INFO

2024-11-24T18:36:10Z INF cmd/node/main.go:55 > Starting application hello="This si san  error!!"
2024-11-24T18:36:10Z INF Server built
2024-11-24T18:36:10Z INF internal/node/app/app.go:25 > Starting the application...
2024-11-24T18:36:10Z ??? ⇨ http server started on [::]:9151

If I could intercept it, then this line

2024-11-24T18:36:10Z ??? ⇨ http server started on [::]:9151

Could become

2024-11-24T18:36:10Z INF ⇨ http server started on [::]:9151

I know this is not a problem of lecho, Echo is probably not including the level, but I was hoping to intercept it and replace it

Or is there a better way to do this ?

THanks in advance

Ian

iangregsondev commented 1 day ago

Also, with the same subject, I added CallerWithSkipFrameCount

And it works great, but I was wondering if its possible to override (delete actually) anything that doesn't not come from my own repository

It is outputting color.go

2024-11-24T18:58:51Z INF cmd/node/main.go:55 > Starting application hello="This si san  error!!"
2024-11-24T18:58:51Z INF internal/node/di/builders/infrastructure/server/build.go:52 > Server built
2024-11-24T18:58:51Z INF internal/node/app/app.go:25 > Starting the application...
2024-11-24T18:58:51Z ??? ../../../../../.gobrew/current/go/pkg/mod/github.com/labstack/gommon@v0.4.2/color/color.go:173 > ⇨ http server started on [::]:9151