How to use _get_file_logging_context method in Slash

Best Python code snippet using slash

log.py

Source:log.py Github

copy

Full Screen

...119 def get_active_log_paths(self):120 return [log_path for log_path, handler in self._log_path_to_handler.items() if handler is not None]121 @contextmanager122 def get_test_logging_context(self, result):123 with self._get_file_logging_context(config.root.log.subpath, config.root.log.last_test_symlink) as (_, path):124 self.test_log_path = path125 result.set_log_path(path)126 try:127 yield path128 finally:129 self._create_last_failed_symlink_if_needed(result)130 def _create_last_failed_symlink_if_needed(self, result):131 assert result132 if result.is_error() or result.is_failure():133 self._try_create_symlink(result.get_log_path(), config.root.log.last_failed_symlink)134 @contextmanager135 def get_session_logging_context(self):136 assert self.session_log_handler is None137 with self._get_file_logging_context(138 config.root.log.session_subpath, config.root.log.last_session_symlink) as (handler, path):139 self.session_log_handler = handler140 self.session_log_path = path141 self.session.results.global_result.set_log_path(path)142 if config.root.log.last_session_dir_symlink is not None and self.session_log_path is not None:143 self._try_create_symlink(os.path.dirname(self.session_log_path), config.root.log.last_session_dir_symlink)144 yield path145 @contextmanager146 def _get_file_logging_context(self, filename_template, symlink):147 with ExitStack() as stack:148 handler = stack.enter_context(self._log_file_handler_context(filename_template, symlink, \149 use_compression=config.root.log.compression.enabled))150 stack.enter_context(handler.applicationbound())151 if config.root.log.compression.enabled and config.root.log.compression.use_rotating_raw_file:152 rotating_handler = stack.enter_context(self._log_file_handler_context(filename_template, symlink, bubble=True, use_rotation=True))153 stack.enter_context(rotating_handler.applicationbound())154 stack.enter_context(self.console_handler.applicationbound())155 stack.enter_context(self.warnings_handler.applicationbound())156 error_handler = stack.enter_context(self._get_error_logging_context())157 stack.enter_context(error_handler.applicationbound())158 stack.enter_context(self._get_silenced_logs_context())159 if config.root.log.unittest_mode:160 stack.enter_context(logbook.StreamHandler(sys.stderr, bubble=True, level=logbook.TRACE))...

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 Slash 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