-
Notifications
You must be signed in to change notification settings - Fork 82
Support Opt-In behaviour for logging requests #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That definitely makes sense, we have a few endpoints we aren't particularly interested in or are only interested in if they error, so maybe instead of a hard true/ false the decorator could accept a condition or lambda just to make this even more fun for you to implement? I can certainly see users who only want to use the package in certain cases but for backwards-compatibility the default would still need to be everything, yeah. |
@tclancy what about instead of a true false in the setting we made it an enum / well formed string, something like: REQUEST_LOGGING_DEFAULT_OPT_IN_LEVEL: str = "ALL" # Default value, opt in to logging all requests Where it could also be something like EDIT: (as a side note, I'm not opposed to implementing a lambda, I'm just wondering what could be the easiest thing to use / what level of sophistication would be needed from the get go) Also as a side note, I just realized that the |
That would work, it just wouldn't suit our use case.
Argh, I will try to do that as soon as I can; I've just switched to a new laptop so it won't be until next week, but if you don't see it by Friday, please ping me here. |
May as well get it to suit your use case + mine so it's more immediately useful 😄 |
I haven't forgotten about this, just a crazy week. |
Requests logging opt-in
I have a number of services that have certain endpoints that we would love to use request logging for, but, they also contain a number of endpoints that are much more "spammy" and we don't really get a benefit from emitting logs for each request. What would your thoughts be on updating the framework to support a setting making request logging opt-in. Something like
Then, a decorator could be used like
opt_in_to_logging(silent=True)
, which could raise an error ifREQUEST_LOGGING_DEFAULT_OPT_IN
is trueMisc
silent=False
onno_logging
- I wouldn't mind implementing this!no_logging
will still generate a log message tooThe text was updated successfully, but these errors were encountered: