SolidSyslog coverage report
Current view: top level - Core/Source - SolidSyslogSenderHealth.c (source / functions) Coverage Total Hit
Test: SolidSyslog Lines: 100.0 % 12 12
Test Date: 2026-11-12 23:14:35 Functions: 100.0 % 1 1
Branches: 100.0 % 4 4

             Branch data     Line data    Source code
       1                 :             : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
       2                 :             :  * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
       3                 :             :  */
       4                 :             : 
       5                 :             : #include "SolidSyslogSenderHealth.h"
       6                 :             : 
       7                 :             : #include "SolidSyslogError.h"
       8                 :             : #include "SolidSyslogPrival.h"
       9                 :             : #include "SolidSyslogSenderCategories.h"
      10                 :             : 
      11                 :        3546 : void SolidSyslogSenderHealth_Update(
      12                 :             :     bool* healthy,
      13                 :             :     bool delivered,
      14                 :             :     const struct SolidSyslogSenderHealthReporter* reporter
      15                 :             : )
      16                 :             : {
      17                 :        3546 :     bool healthChanged = (delivered != *healthy);
      18         [ +  + ]:        3546 :     if (healthChanged)
      19                 :             :     {
      20                 :         224 :         *healthy = delivered;
      21         [ +  + ]:         224 :         if (delivered)
      22                 :             :         {
      23                 :          93 :             SolidSyslog_Error(
      24                 :             :                 SOLIDSYSLOG_SEVERITY_NOTICE,
      25                 :          93 :                 reporter->Source,
      26                 :             :                 SOLIDSYSLOG_CAT_SENDER_DELIVERY_RESTORED,
      27                 :          93 :                 reporter->RestoredDetail
      28                 :             :             );
      29                 :             :         }
      30                 :             :         else
      31                 :             :         {
      32                 :             :             /* WARNING: a destination outage is recoverable (store-and-forward
      33                 :             :              * covers it) and may clear on its own - it is not a library fault.
      34                 :             :              * Setup faults an integrator must fix in code (bad config, pool
      35                 :             :              * exhaustion) are CRITICAL; see docs/error-severity.md. */
      36                 :         131 :             SolidSyslog_Error(
      37                 :             :                 SOLIDSYSLOG_SEVERITY_WARNING,
      38                 :         131 :                 reporter->Source,
      39                 :             :                 SOLIDSYSLOG_CAT_SENDER_DELIVERY_FAILED,
      40                 :         131 :                 reporter->FailedDetail
      41                 :             :             );
      42                 :             :         }
      43                 :             :     }
      44                 :        3546 : }
        

Generated by: LCOV version 2.0-1