How to use setup_logging_for_cli method in localstack

Best Python code snippet using localstack_python

localstack.py

Source:localstack.py Github

copy

Full Screen

...25def _setup_cli_debug():26 from localstack.logging.setup import setup_logging_for_cli27 config.DEBUG = True28 os.environ["DEBUG"] = "1"29 setup_logging_for_cli(logging.DEBUG if config.DEBUG else logging.INFO)30@click.group(name="localstack", help="The LocalStack Command Line Interface (CLI)")31@click.version_option(version=__version__, message="%(version)s")32@click.option("--debug", is_flag=True, help="Enable CLI debugging mode")33@click.option("--profile", type=str, help="Set the configuration profile")34def localstack(debug, profile):35 if profile:36 os.environ["CONFIG_PROFILE"] = profile37 if debug:38 _setup_cli_debug()39 from localstack.utils.files import cache_dir40 # overwrite the config variable here to defer import of cache_dir41 if not config.LEGACY_DIRECTORIES and not os.environ.get("LOCALSTACK_VOLUME_DIR", "").strip():42 config.VOLUME_DIR = cache_dir() / "volume"43@localstack.group(name="config", help="Inspect your LocalStack configuration")...

Full Screen

Full Screen

setup.py

Source:setup.py Github

copy

Full Screen

...26}27trace_internal_log_levels = {28 "localstack.request.internal": logging.DEBUG,29}30def setup_logging_for_cli(log_level=logging.INFO):31 logging.basicConfig(level=log_level)32 # set log levels of loggers33 logging.root.setLevel(log_level)34 logging.getLogger("localstack").setLevel(log_level)35 for logger, level in default_log_levels.items():36 logging.getLogger(logger).setLevel(level)37def get_log_level_from_config():38 # overriding the log level if LS_LOG has been set39 if config.LS_LOG:40 log_level = str(config.LS_LOG).upper()41 if log_level.lower() in constants.TRACE_LOG_LEVELS:42 log_level = "DEBUG"43 log_level = logging._nameToLevel[log_level]44 return log_level...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful