mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:42:58 +03:00
🚀 Feature: Log levels #318
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mihakrumpestar on GitHub.
Feature description
It would be great if we could set container log level as currently GIN logs every single request, which in my home-lab produces almost 7,000 log entries per hour.
Pitch
I always set log level to warning, so I can clearly see if anything is wrong, as finding an error entry among 1000-ts of logs is a lot harder.
@mihakrumpestar commented on GitHub:
It is unset, as I checked the code where "production" is the default.
@mihakrumpestar commented on GitHub:
Well, GIN logs are completely irrelevant, and produce a ton of output.
I would appreciate a log level
warning, where I can see if any problems arise, without any irrelevant info data like successful requests.@kmendell commented on GitHub:
@mihakrumpestar Correct prod is the default, even with that its still producing too many logs? I could maybe see a feature for a ENV varibale to disable logs if needed, but its usually good practice to keep those logs in the event of security issues or troubelshooting.
What logs are you trying not to see is a better question i guess?
@kmendell commented on GitHub:
@mihakrumpestar What is your
APP_ENVvariable set too? It should cut down on logging if its set to:APP_ENV=production@kmendell commented on GitHub:
I dont see a default way to do this in GIN, unless you use the
Skipperfunction, so if implemented, it would a be a bit of work. @stonith404 what are your thoughts?@stonith404 commented on GitHub:
@kmendell It seems like
gin.New()creates a logging middleware. For supporting log levels we would have to create a custom logger.I think this would make sense to implement but it's definitely not at the top of the priority list. But we are open for pull requests or upvotes (👍) which would prioritize the issue more.
@kklee998 commented on GitHub:
Seems like the default Gin logger does not support logging levels. How about using this logging middleware from
gin-contrib:Here is a rough sketch of the code:
Logs look like this:
If you guys are okay with taking on an extra dependency, I can open a PR to properly implement this