Esempio n. 1
0
    def _log(self, message: str, severity: int, indent: int,
             prefix: str) -> None:
        if len(self._lines) == self._maxlines:
            self._lines.append(
                (datetime.datetime.now(),
                 'Log trimmed at {} lines'.format(self._maxlines),
                 Logger.ERROR))

        if len(self._lines) >= self._maxlines:
            return

        self._lines.append((datetime.datetime.now(),
                            format_log_entry(message, severity, indent,
                                             prefix), severity))
Esempio n. 2
0
    def _log(self, message: str, severity: int, indent: int,
             prefix: str) -> None:
        if self._numlines == self._maxlines:
            self._db.add_log_line(
                self._run_id, self._numlines + 1, None,
                _severity_to_sql(Logger.ERROR),
                'Log trimmed at {} lines'.format(self._maxlines))
            self._numlines += 1

        if self._numlines >= self._maxlines:
            return

        self._db.add_log_line(
            self._run_id, self._numlines + 1, None, _severity_to_sql(severity),
            format_log_entry(message, severity, indent, prefix))
        self._numlines += 1