コード例 #1
0
ファイル: reports.py プロジェクト: morganstanley/testplan
    def get_logs(self, source, depth, row_idx, lvl=logging.ERROR):
        """
        Get logs created by the `report.logger` object.
        Only select the logs with severity level equal to or higher than `lvl`.
        """
        font_size = const.FONT_SIZE_SMALL
        width = const.WRAP_LIMITS[font_size]
        logs = [log for log in source.logs if log["levelno"] >= lvl]

        return (
            RowData(
                start=row_idx,
                content=[
                    [wrap(log["message"], width=width), "", "", ""]
                    for log in logs
                ],
                style=RowStyle(
                    font=(const.FONT, font_size),
                    left_padding=const.INDENT * depth,
                    text_color=colors.gray,
                ),
            )
            if logs
            else None
        )
コード例 #2
0
    def get_logs(self, logs, depth, row_idx):
        """Logs created by the `report.logger` object."""
        font_size = const.FONT_SIZE_SMALL
        width = const.WRAP_LIMITS[font_size]

        return RowData(
            start=row_idx,
            content=[[wrap(log['message'], width=width), '', '', '']
                     for log in logs],
            style=RowStyle(
                font=(const.FONT, font_size),
                left_padding=const.INDENT * depth,
                text_color=colors.gray,
            ))