コード例 #1
0
def test_logbook_handler_emit_error(capsys, elasticapm_client):
    handler = LogbookHandler(elasticapm_client)
    handler._emit = lambda: 1 / 0
    handler.emit(LogRecord("x", 1, "Oops"))
    out, err = capsys.readouterr()
    assert "Top level ElasticAPM exception caught" in err
    assert "Oops" in err
コード例 #2
0
def test_logbook_handler_dont_emit_elasticapm(capsys, elasticapm_client):
    handler = LogbookHandler(elasticapm_client)
    handler.emit(LogRecord("elasticapm.errors", 1, "Oops"))
    out, err = capsys.readouterr()
    assert "Oops" in err
コード例 #3
0
def test_logbook_handler_dont_emit_elasticapm(capsys, elasticapm_client):
    handler = LogbookHandler(elasticapm_client)
    handler.emit(LogRecord('elasticapm.errors', 1, 'Oops'))
    out, err = capsys.readouterr()
    assert 'Oops' in err