def __del__(self): self.flush() if self.config['show_status_message']: #parse log log_file = self.join_path( self.config['log_file'] ) if self.config['log_file'] is not None else None if not log_file or self.config['parse_log'] is False: logger.info('Completed') else: logdata = common.parse_log(log_file) if logdata['errors'] == 0 and logdata['warnings'] == 0: logger.info('Completed successfully') else: logger.info('Completed with %s warning(s) and %s error(s)', logdata['warnings'], logdata['errors']) time_elapsed = round(time.time() - self._time_start, 2) minutes = round(time_elapsed / 60) if time_elapsed > 60 else 0 seconds = time_elapsed - minutes * 60 if minutes: logger.info('time elapsed: %s minutes %s seconds', minutes, seconds) else: logger.info('time elapsed: %s seconds', seconds)
def __del__(self): self.flush() if self.config['show_status_message']: #parse log log_file = self.join_path(self.config['log_file']) if self.config['log_file'] is not None else None if not log_file or self.config['parse_log'] is False: logger.info('Completed') else: logdata = common.parse_log(log_file) if logdata['errors'] == 0 and logdata['warnings'] == 0: logger.info('Completed successfully') else: logger.info('Completed with %s warning(s) and %s error(s)', logdata['warnings'], logdata['errors']) time_elapsed = round(time.time() - self._time_start, 2) minutes = round(time_elapsed/60) if time_elapsed > 60 else 0 seconds = time_elapsed - minutes * 60 if minutes: logger.info('time elapsed: %s minutes %s seconds', minutes, seconds) else: logger.info('time elapsed: %s seconds', seconds)
def get_log_stats(self): log_file = self.join_path(self.config['log_file']) if self.config['log_file'] is not None else None if log_file is None or not os.path.exists(log_file): return '' else: logdata = common.parse_log(log_file) if logdata['errors'] == 0 and logdata['warnings'] == 0: return 'no warnings, no errors' else: return '%s warning(s) and %s error(s)' % ( logdata['warnings'], logdata['errors'] )
def __del__(self): self.flush() if self.config['show_status_message']: #parse log log_file = self.join_path('log.txt') if not os.path.exists(log_file) or self.config['parse_log'] is False: self.logger.info('Completed') else: logdata = common.parse_log(log_file) if logdata['errors'] == 0 and logdata['warnings'] == 0: self.logger.info('Completed successfully') else: self.logger.info('Completed with %s warning(s) and %s error(s)', logdata['warnings'], logdata['errors']) time_elapsed = round(time.time() - self._time_start, 2) self.logger.info('time elapsed: %s minutes', round(time_elapsed/60))