console notifier: hide description reduce the log

This commit is contained in:
Chi Song 2021-08-05 00:28:19 -07:00 коммит произвёл Chi Song
Родитель 3652454d9b
Коммит 7355f5a4d4
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
import logging
from dataclasses import dataclass
from typing import Any, List, Type, cast
@ -34,6 +35,12 @@ class Console(notifier.Notifier):
return ConsoleSchema
def _received_message(self, message: notifier.MessageBase) -> None:
if isinstance(message, TestResultMessage):
# The description of test result is too long to display. Hide it for
# log readability.
message = copy.deepcopy(message)
description = message.information.get("description", "")
message.information["description"] = f"<{len(description)} bytes>"
self._log.log(
getattr(logging, self._log_level),
f"received message [{message.type}]: {message}",