zscaler/zscaler-sdk-python

[FEATURE] Is there an option to disable this caching output to stdout while accessing SDK

Opened this issue · 4 comments

gopurx commented

Problem Statement
Is there an option to disable this caching output to stdout while accessing SDK
WARNING - Saving to cache.

Proposed Solution
option to disable this echo, as this could be noisy during automation and invoking 10s of methods for 100s of resources

Additional Context
Add any other context, references or screenshots about the feature request here.

@gopurx There's is no exposed option today to simply disable the stdout.
This output is only presented if you are executing your code in debug mode i.e
ZSCALER_SDK_LOG - Turn on logging
ZSCALER_SDK_VERBOSE - Turn on logging in verbose mode
Which we do not recommend for any production environments.
If you are running as a development in your local environment, you can simply remove or comment the following lines
logging.debug("Serving from cache.") in the no_op_cache.py file and recompile the package again.

Zscaler DevRel

gopurx commented

Every time an SDK is referred, we are getting this trace of line which is not of use as much. It would be easy if there is an option to disable this or redirect to a file.

"2024-10-11 10:06:45,115 - WARNING - Saving to cache.
2024-10-11 10:06:47,089 - WARNING - Saving to cache.
2024-10-11 10:06:49,242 - WARNING - Saving to cache.
2024-10-11 10:06:52,929 - WARNING - Saving to cache.
2024-10-11 10:06:54,951 - WARNING - Saving to cache.
2024-10-11 10:06:56,277 - WARNING - Saving to cache.
2024-10-11 10:06:58,323 - WARNING - Saving to cache.
2024-10-11 10:07:03,183 - WARNING - Saving to cache.
2024-10-11 10:07:13,302 - WARNING - Saving to cache.
2024-10-11 10:07:14,389 - WARNING - Saving to cache.
2024-10-11 10:07:16,453 - WARNING - Saving to cache.

Ok as I said this is only shown if you're running the SDK in debug mode, which we do not recommend.
We will implement an option to explicitly disable logging in the future.

gopurx commented