MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / configure_logging_from_env

Function configure_logging_from_env

dwave/cloud/utils/logging.py:236–251  ·  view source on GitHub ↗

Use ``DWAVE_LOG_LEVEL`` (name or value) and ``DWAVE_LOG_FORMAT`` ("json" for structured output) environment variables to configure logging.

(logger: logging.Logger)

Source from the content-addressed store, hash-verified

234
235
236def configure_logging_from_env(logger: logging.Logger) -> bool:
237 """Use ``DWAVE_LOG_LEVEL`` (name or value) and ``DWAVE_LOG_FORMAT`` ("json"
238 for structured output) environment variables to configure logging.
239 """
240
241 log_level = os.getenv('DWAVE_LOG_LEVEL', os.getenv('dwave_log_level'))
242 log_format = os.getenv('DWAVE_LOG_FORMAT', os.getenv('dwave_log_format', ''))
243
244 if not log_level:
245 return False
246
247 configure_logging(logger, additive=False,
248 level=parse_loglevel(log_level),
249 structured_output=(log_format.strip().lower() == 'json'))
250
251 return True
252
253
254def pretty_argvalues():

Callers 1

__init__.pyFile · 0.90

Calls 2

configure_loggingFunction · 0.85
parse_loglevelFunction · 0.85

Tested by

no test coverage detected