Ejemplo n.º 1
0
 def _hook(job, entry):
     """The core hook, which can safely call job.record."""
     entries = []
     # poll all our warning loggers for new warnings
     for timestamp, msg in job._read_warnings():
         warning_entry = base_job.status_log_entry("WARN", None, None, msg, {}, timestamp=timestamp)
         entries.append(warning_entry)
         job.record_entry(warning_entry)
     # echo rendered versions of all the status logs to info
     entries.append(entry)
     for entry in entries:
         rendered_entry = job._logger.render_entry(entry)
         logging.info(rendered_entry)
         job._parse_status(rendered_entry)
Ejemplo n.º 2
0
 def _hook(job, entry):
     """The core hook, which can safely call job.record."""
     entries = []
     # poll all our warning loggers for new warnings
     for timestamp, msg in job._read_warnings():
         warning_entry = base_job.status_log_entry(
             'WARN', None, None, msg, {}, timestamp=timestamp)
         entries.append(warning_entry)
         job.record_entry(warning_entry)
     # echo rendered versions of all the status logs to info
     entries.append(entry)
     for entry in entries:
         rendered_entry = job._logger.render_entry(entry)
         logging.info(rendered_entry)
         job._parse_status(rendered_entry)
Ejemplo n.º 3
0
        def make(status_code, dt, msg=''):
            """Makes a base_job.status_log_entry.

            @param status_code: String status code.
            @param dt: datetime.datetime object containing entry time.
            @param msg: String message (typically only set for errors).
            @return: base_job.status_log_entry object.
            """
            timestamp = int((dt - tast._UNIX_EPOCH).total_seconds())
            return base_job.status_log_entry(status_code,
                                             None,
                                             tast.tast._TEST_NAME_PREFIX +
                                             self._name,
                                             msg,
                                             None,
                                             timestamp=timestamp)
Ejemplo n.º 4
0
    def _log_test_event(self, status_code, test_name, timestamp, message=''):
        """Logs a single event to the TKO status.log file.

        @param status_code: Event status code, e.g. 'END GOOD'. See
            client/common_lib/log.py for accepted values.
        @param test_name: Tast test name, e.g. 'ui.ChromeLogin'.
        @param timestamp: Event timestamp (as seconds since Unix epoch).
        @param message: Optional human-readable message.
        """
        full_name = self._TEST_NAME_PREFIX + test_name
        # The TKO parser code chokes on floating-point timestamps.
        entry = base_job.status_log_entry(status_code,
                                          None,
                                          full_name,
                                          message,
                                          None,
                                          timestamp=int(timestamp))
        self.job.record_entry(entry, False)