Best Python code snippet using slash
log.py
Source:log.py
...130 stack.enter_context(handler.applicationbound())131 stack.enter_context(self.console_handler.applicationbound())132 stack.enter_context(self.warnings_handler.applicationbound())133 stack.enter_context(self._get_error_logging_context())134 stack.enter_context(self._get_silenced_logs_context())135 if config.root.log.unittest_mode:136 stack.enter_context(logbook.StreamHandler(sys.stderr, bubble=True, level=logbook.TRACE))137 for extra_handler in _extra_handlers:138 stack.enter_context(extra_handler.applicationbound())139 if config.root.log.unified_session_log and self.session_log_handler is not None:140 stack.enter_context(_make_bubbling_handler(self.session_log_handler))141 yield handler, path142 finally:143 if path is not None:144 hooks.log_file_closed() # pylint: disable=no-member145 if config.root.log.cleanup.enabled and self._should_delete_log():146 os.remove(path)147 def _should_delete_log(self):148 return (not config.root.log.cleanup.keep_failed) or \149 (not self.session.results.current.is_global_result() and self.session.results.current.is_success(allow_skips=True)) or \150 (self.session.results.current.is_global_result() and self.session.results.is_success(allow_skips=True))151 def _get_error_logging_context(self):152 path = config.root.log.errors_subpath153 if path:154 warn_deprecation('log.errors_subpath configuration is deprecated since 1.5.0. '155 'Please use log.highlights_subpath instead')156 else:157 path = config.root.log.highlights_subpath158 def _error_added_filter(record, handler): # pylint: disable=unused-argument159 return record.extra.get('highlight')160 handler, log_path = self._get_file_log_handler(path, symlink=None, bubble=True, filter=_error_added_filter)161 if log_path and self.session.results.current is self.session.results.global_result:162 self.session.results.global_result.add_extra_log_path(log_path)163 return handler.applicationbound()164 def _get_silenced_logs_context(self):165 if not config.root.log.silence_loggers:166 return ExitStack()167 return SilencedLoggersHandler(config.root.log.silence_loggers).applicationbound()168 def _get_file_log_handler(self, subpath, symlink, bubble=False, filter=None):169 root_path = config.root.log.root170 if root_path is None or subpath is None:171 log_path = None172 if bubble:173 handler = NoopHandler()174 else:175 handler = logbook.NullHandler(filter=filter)176 else:177 log_path = self._normalize_path(os.path.join(root_path, _format_log_path(subpath)))178 ensure_containing_directory(log_path)...
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!!