You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Logger panics after SetHeader with empty string #2295
Hi, thanks for reply.
I want to provide server with my logger, but not satisfying echo.Logger interface for some reasons (mainly it looks too detailed). So I tried to set empty header and provide io.Writer (throw SetOutput), which will merge echo`s logs to my main logger.
@aldas Thanks for suggestion I already use RequestLogger for requests. But as I can see Logger is used for some internal purposes in Response.WriteHeader and in Router.Add. I guess I probably will never need to see logs from Router.Add but I am not sure about WriteHeader and possible future changes, which may add more internal logging.
Activity
glumpo commentedon Oct 5, 2022
Issue is already fixed in logger
https://github.com/labstack/gommon/blob/6267eb7480ded0b4c030ca5e7320417281bb4cd6/log/log.go#L394
Will you update dependency, or we are waiting for release or something?
aldas commentedon Oct 5, 2022
I'll bump version soon.
Are you trying to disable logger or why are you setting header to empty string?
glumpo commentedon Oct 5, 2022
Hi, thanks for reply.
I want to provide server with my logger, but not satisfying echo.Logger interface for some reasons (mainly it looks too detailed). So I tried to set empty header and provide
io.Writer(throwSetOutput), which will merge echo`s logs to my main logger.aldas commentedon Oct 5, 2022
@glumpo what are you logging? If its requests then I strongly suggest you to use newer logger middleware https://github.com/labstack/echo/blob/master/middleware/request_logger.go See examples there at the beginning. RequestLogger middleware is built to be used with 3rd party logger libraries (like Zap, Zerolog etc).
glumpo commentedon Oct 6, 2022
@aldas Thanks for suggestion I already use RequestLogger for requests. But as I can see Logger is used for some internal purposes in
Response.WriteHeaderand inRouter.Add. I guess I probably will never need to see logs fromRouter.Addbut I am not sure aboutWriteHeaderand possible future changes, which may add more internal logging.aldas commentedon Oct 12, 2022
This is fixed in
v4.9.1. I bumped gommon version.