示例#1
0
    def test_warehouse_logger_no_renderer(self):
        formatter = wlogging.StructlogFormatter()
        record = logging.LogRecord(
            "warehouse.request",
            logging.INFO,
            None, None, "the message", None, None,
        )

        assert formatter.format(record) == "the message"
示例#2
0
    def test_non_warehouse_logger_renders(self):
        formatter = wlogging.StructlogFormatter()
        record = logging.LogRecord("another.logger", logging.INFO, None, None,
                                   "the message", None, None)

        assert json.loads(formatter.format(record)) == {
            "logger": "another.logger",
            "level": "INFO",
            "event": "the message",
            "thread": threading.get_ident(),
        }