How to use get_timestamped_log_name method in autotest

Best Python code snippet using autotest_python

drone_logging_config.py

Source:drone_logging_config.py Github

copy

Full Screen

...10 Drone_utility is kicked off on each tick, so this logging config sets up11 the log file to timestamp by day and will create a daily log file.12 """13 @classmethod14 def get_timestamped_log_name(cls, base_name):15 """Generate a log file name based off of Today's Date.16 Normally the other processes in the infrastructure (like the scheduler)17 are kicked off once for long periods of time. However drone_utility is18 kicked off once per tick. Therefore get_timestamped_log_name is19 overloaded so the returned log name just includes the current date.20 @param base_name: String to start the log's filename with.21 @returns String of the base_name suffixed with a timestamp of today's22 date.23 """24 return '%s.log.%s' % (base_name, time.strftime('%Y-%m-%d'))25 def configure_logging(self, log_dir=None, logfile_name=None):26 """Configure logging for the Drones.27 If log_dir and logfile_name are not provided, it will request a28 timestamped log name with prefix 'drone'. Both the stdout and stderr29 logging handlers are disabled because drone_utility's output is parsed30 by the caller.31 This function is called by client/common_lib/logging_manager.py which32 manages a logging_config. For example if any modules want to adjust33 logging (enabling and/or disabling loggers) after drone_utility has34 started they will do so through the logging_manager.35 @param log_dir: Directory to store the log in. If none will use36 /usr/local/autotest/logs37 @param logfile_name: Name of the log file. If none it will be in the38 format of 'drone.log.YEAR-MONTH-DAY'39 """40 # Disable the default stdout/stderr handlers.41 self._clear_all_handlers()42 if log_dir is None:43 log_dir = self.get_server_log_dir()44 if not logfile_name:45 logfile_name = self.get_timestamped_log_name('drone')46 for level in (logging.DEBUG, logging.INFO, logging.WARNING,47 logging.ERROR, logging.CRITICAL):...

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