def test_txlog_write_binary(handler, framework):
    pytest.importorskip("twisted.logger")
    from txaio.tx import _LogObserver

    out_file = BytesIO()
    observer = _LogObserver(out_file)

    observer({
        "log_format": "hi: {testentry}",
        "testentry": "hello",
        "log_level": observer.to_tx["info"],
        "log_time": 1442890018.002233
    })

    output = out_file.getvalue()
    assert b"hi: hello" in output
Writing to a binary stream is supported.
dataset/ETHPy150Open crossbario/txaio/test/test_logging.py/test_txlog_write_binary