opensearch-py
opensearch-py copied to clipboard
[FEATURE] Add option to turn off success logs
Is your feature request related to a problem?
No
What solution would you like?
An argument to opensearch client's __init__
method to turn off the successful requests log
What alternatives have you considered?
Describe in the next section :)
Do you have any additional context?
After reading the code, the Conneciton
instance method perform_request
will call log_request_success
each time the request is made. Currently the only way to turn off this default behavior is to setting 'opensearch' logger's level to a higher level than INFO, by code like this:
import logging
logging.getLogger("opensearch").setLevel(logging.INFO)
Which force the developer to look inside the library's code and set the log level manually.
This makes sense. Logging too much can be worse than not logging enough, especially if it's not obvious that it's happening.
@crystaldust Any interest in picking this up?
I reduced the amount of unnecessary processing in logging in https://github.com/opensearch-project/opensearch-py/pull/571, but we should be able to do more.