Best Python code snippet using autotest_python
logfile_monitor.py
Source:logfile_monitor.py  
...155    def remote_path_exists(self, remote_path):156        """Return True if remote_path exists, False otherwise."""157        return not self.run(158            'ls %s' % remote_path, ignore_status=True).exit_status159    def check_remote_paths(self, remote_paths):160        """Return list of remote_paths that currently exist."""161        return [162            path for path in remote_paths if self.remote_path_exists(path)]163    @_log_and_ignore_exceptions164    def __start_loggers(self):165        """Start multifile monitoring logger.166        Launch monitors/followfiles.py on the target and hook its output167        to monitors/console.py locally.168        """169        # Check if follow_paths exist, in the case that one doesn't170        # emit a warning and proceed.171        follow_paths_set = set(self.follow_paths)172        existing = self.check_remote_paths(follow_paths_set)173        missing = follow_paths_set.difference(existing)174        if missing:175            # Log warning that we are missing expected remote paths.176            logging.warn('Target %s is missing expected remote paths: %s',177                         self.hostname, ', '.join(missing))178        # If none of them exist just return (for now).179        if not existing:180            return181        # Create a new lastlines_dirpath on the remote host if not already set.182        if not self._lastlines_dirpath:183            self._lastlines_dirpath = self.get_tmp_dir(parent='/var/tmp')184        # Launch followfiles on target185        self._followfiles_proc = launch_remote_followfiles(186            self, self._lastlines_dirpath, existing)...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!!
