Best Python code snippet using localstack_python
logging.py
Source:logging.py
...60 # make sure loggers are loaded after logging config is loaded61 def _prepare_logger(self, logger: logging.Logger, formatter: Type):62 if logger.isEnabledFor(logging.DEBUG):63 logger.propagate = False64 handler = create_default_handler(logger.level)65 handler.setFormatter(formatter())66 logger.addHandler(handler)67 return logger68 def _log(self, context: RequestContext, response: Response):69 aws_logger = self.aws_logger70 http_logger = self.http_logger71 is_internal_call = is_internal_call_context(context.request.headers)72 if is_internal_call:73 aws_logger = self.internal_aws_logger74 http_logger = self.internal_http_logger75 if context.operation:76 # log an AWS response77 if context.service_exception:78 aws_logger.info(...
setup.py
Source:setup.py
...51 logging.getLogger(name).setLevel(level)52 if config.LS_LOG == "trace-internal":53 for name, level in trace_internal_log_levels.items():54 logging.getLogger(name).setLevel(level)55def create_default_handler(log_level: int):56 log_handler = logging.StreamHandler(stream=sys.stderr)57 log_handler.setLevel(log_level)58 log_handler.setFormatter(DefaultFormatter())59 log_handler.addFilter(AddFormattedAttributes())60 return log_handler61def setup_logging(log_level=logging.INFO) -> None:62 """63 Configures the python logging environment for LocalStack.64 :param log_level: the optional log level.65 """66 # set create a default handler for the root logger (basically logging.basicConfig but explicit)67 log_handler = create_default_handler(log_level)68 # replace any existing handlers69 logging.basicConfig(level=log_level, handlers=[log_handler])70 # disable some logs and warnings71 warnings.filterwarnings("ignore")72 logging.captureWarnings(True)73 # set log levels of loggers74 logging.root.setLevel(log_level)75 logging.getLogger("localstack").setLevel(log_level)76 for logger, level in default_log_levels.items():77 logging.getLogger(logger).setLevel(level)78def setup_hypercorn_logger(hypercorn_config) -> None:79 """80 Sets the hypercorn loggers, which are created in a peculiar way, to the localstack settings.81 :param hypercorn_config: a hypercorn.Config object...
defaults.py
Source:defaults.py
1from redbird.logging import RepoHandler2from redbird.repos import MemoryRepo3from .log_record import MinimalRecord4def create_default_handler():5 "Create default handler that can be read"6 return RepoHandler(7 repo=MemoryRepo(model=MinimalRecord)...
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!!