def _configure_logging(logger, loglevel): """Configure `logger` root logger.""" # TODO: move to dwave "common utils" module formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(threadName)s %(message)s') handler = logging.StreamHandler() handler.setFormatter(formatter) logger.addHandler(handler) set_loglevel(logger, loglevel)
def enable_loglevel(ctx, param, value): if value and not ctx.resilient_parsing: set_loglevel(dwave.cloud.logger, value)
def _apply_loglevel_from_env(logger): set_loglevel(logger, os.getenv('DWAVE_LOG_LEVEL'))