Best Python code snippet using localstack_python
sfx_collectd_utilities.py
Source:sfx_collectd_utilities.py
...73 """74 self.log(25, msg)75# assign the custom CollectdLogger to be the default logging class76logging.setLoggerClass(CollectdLogger)77def get_log_level_from_config(val):78 """Takes a config value and maps it to a log level79 Default Value: logging.INFO80 """81 # normalize the value82 value = str(val).upper()83 log_level = logging.INFO84 if value == 'DEBUG':85 log_level = logging.DEBUG86 elif value == 'INFO':87 log_level = logging.INFO88 elif value == 'NOTICE':89 # NOTICE is a custom level in sfx_utilities.CollectdLogger90 log_level = 2591 elif value == 'WARNING':...
setup.py
Source:setup.py
...35 logging.root.setLevel(log_level)36 logging.getLogger("localstack").setLevel(log_level)37 for logger, level in default_log_levels.items():38 logging.getLogger(logger).setLevel(level)39def get_log_level_from_config():40 # overriding the log level if LS_LOG has been set41 if config.LS_LOG:42 log_level = str(config.LS_LOG).upper()43 if log_level.lower() in constants.TRACE_LOG_LEVELS:44 log_level = "DEBUG"45 log_level = logging._nameToLevel[log_level]46 return log_level47 return logging.DEBUG if config.DEBUG else logging.INFO48def setup_logging_from_config():49 log_level = get_log_level_from_config()50 setup_logging(log_level)51 if config.is_trace_logging_enabled():52 for name, level in trace_log_levels.items():53 logging.getLogger(name).setLevel(level)54 if config.LS_LOG == "trace-internal":55 for name, level in trace_internal_log_levels.items():56 logging.getLogger(name).setLevel(level)57def create_default_handler(log_level: int):58 log_handler = logging.StreamHandler(stream=sys.stderr)59 log_handler.setLevel(log_level)60 log_handler.setFormatter(DefaultFormatter())61 log_handler.addFilter(AddFormattedAttributes())62 return log_handler63def setup_logging(log_level=logging.INFO) -> None:...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!