diff --git a/borgmatic/hooks/healthchecks.py b/borgmatic/hooks/healthchecks.py index 1cd9de1..19201d0 100644 --- a/borgmatic/hooks/healthchecks.py +++ b/borgmatic/hooks/healthchecks.py @@ -53,9 +53,8 @@ def format_buffered_logs_for_payload(): if isinstance(handler, Forgetful_buffering_handler) ) except StopIteration: - payload = 'Cannot find the log handler for sending logs to Healthchecks' - logger.warning(payload) - return payload + # No handler means no payload. + return '' payload = ''.join(message for message in buffering_handler.buffer) diff --git a/tests/unit/hooks/test_healthchecks.py b/tests/unit/hooks/test_healthchecks.py index 0c156e5..cbb9cc7 100644 --- a/tests/unit/hooks/test_healthchecks.py +++ b/tests/unit/hooks/test_healthchecks.py @@ -46,14 +46,14 @@ def test_format_buffered_logs_for_payload_inserts_truncation_indicator_when_logs assert payload == '...\nfoo\nbar\n' -def test_format_buffered_logs_for_payload_without_handler_produces_payload_anyway(): +def test_format_buffered_logs_for_payload_without_handler_produces_empty_payload(): flexmock(module.logging).should_receive('getLogger').and_return( flexmock(handlers=[module.logging.Handler()]) ) payload = module.format_buffered_logs_for_payload() - assert payload + assert payload == '' def test_ping_monitor_hits_ping_url_for_start_state():