How to use get_log_level_names method in localstack

Best Python code snippet using localstack_python

kinesis_connector.py

Source:kinesis_connector.py Github

copy

Full Screen

...119 self.log_subscribers = params.get('log_subscribers', [])120 if self.log_level is None:121 self.log_level = DEFAULT_KCL_LOG_LEVEL122 if self.log_level > 0:123 levels = OutputReaderThread.get_log_level_names(self.log_level)124 # regular expression to filter the printed output125 self.filter_regex = r'.*(%s):.*' % ('|'.join(levels))126 # create prefix and logger127 self.prefix = params.get('log_prefix') or 'LOG'128 self.logger = logging.getLogger(self.prefix)129 self.logger.severe = self.logger.critical130 self.logger.fatal = self.logger.critical131 self.logger.setLevel(self.log_level)132 @property133 def running(self):134 return not self._stop_event.is_set()135 @classmethod136 def get_log_level_names(cls, min_level):137 return [logging.getLevelName(lvl) for lvl in LOG_LEVELS if lvl >= min_level]138 def get_logger_for_level_in_log_line(self, line):139 level = self.log_level140 for lvl in LOG_LEVELS:141 if lvl >= level:142 level_name = logging.getLevelName(lvl)143 if re.match(r'.*(%s):.*' % level_name, line):144 return getattr(self.logger, level_name.lower())145 return None146 def notify_subscribers(self, line):147 for subscriber in self.log_subscribers:148 try:149 if re.match(subscriber.regex, line):150 subscriber.update(line)...

Full Screen

Full Screen

logging.py

Source:logging.py Github

copy

Full Screen

...9 """ Obtain the defined log level names and its integer representation.10 :return: A list of tuples with the official level name and its integer value.11 """12 return [(k, v) for k, v in logging._nameToLevel.items()]13def get_log_level_names(low_case: bool = True) -> List[str]:14 """ Obtain a list with the level names.15 :param low_case: If convert the level names into lower case.16 :return: A list of level names.17 """18 return [k.lower() if low_case else k for k in logging._nameToLevel]19def get_log_level(name: str) -> int:20 """ Return the number representation of a level from its name.21 :param name: The level name.22 :return: Its integer value.23 """24 return logging._nameToLevel[name.upper()]25def config_log(level: Union[str, int], filename: Union[str, PathLike, bytes] = None) -> None:26 """ Configure easily the logging using a default log and date format.27 :param level: The level name or number....

Full Screen

Full Screen

loggingtests.py

Source:loggingtests.py Github

copy

Full Screen

...18 log_messages()19 msg = first_line('file.log')20 self.assertEqual(msg[-18:], 'Test error message')21 def test_log_level_names(self) -> None:22 self.assertListEqual(get_log_level_names(),23 ['critical', 'fatal', 'error', 'warn', 'warning', 'info', 'debug', 'notset'])24 def test_log_levels(self) -> None:25 self.assertListEqual(get_log_levels(), [('CRITICAL', 50), ('FATAL', 50), ('ERROR', 40), ('WARN', 30),26 ('WARNING', 30), ('INFO', 20), ('DEBUG', 10), ('NOTSET', 0)])27 def test_log_level(self) -> None:28 self.assertEqual(get_log_level('DEBUG'), 10)29 def test_log_curl_request(self) -> None:30 log_curl_request(logger.error,31 'http://localhost:5000/world_domination',32 'POST',33 {'Content-Type': 'application/json'},34 {'quantity_of_people': 'everybody'},35 AnsiCodes.RED)36 self.assertIn('curl -X POST -H "Content-Type: application/json" "http://localhost:5000/world_domination" '...

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