opensearch-py icon indicating copy to clipboard operation
opensearch-py copied to clipboard

[FEATURE] Add option to turn off success logs

Open crystaldust opened this issue 1 year ago • 3 comments

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.

crystaldust avatar Apr 27 '23 10:04 crystaldust

This makes sense. Logging too much can be worse than not logging enough, especially if it's not obvious that it's happening.

wbeckler avatar May 04 '23 16:05 wbeckler

@crystaldust Any interest in picking this up?

dblock avatar Nov 10 '23 14:11 dblock

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.

dblock avatar Nov 18 '23 13:11 dblock