Skip to content

File SolidSyslogError.h

FileList > Core > Interface > SolidSyslogError.h

The error-reporting API: SolidSyslog_SetErrorHandler to install a handler, SolidSyslog_Error to emit, and the event's Severity / Source / Category / Detail axes a handler reads.

  • #include <stdbool.h>
  • #include <stdint.h>
  • #include "SolidSyslogExternC.h"
  • #include "SolidSyslogPrival.h"

Classes

Type Name
struct SolidSyslogErrorEvent
What a handler receives.
struct SolidSyslogErrorSource
The identity of an error-emitting class.

Public Types Documentation

SolidSyslogErrorDetailNameFunction

How a source names its detail codes: the SolidSyslog<Vocabulary>Errors_Name of the enum it reports through.

typedef const char *(* SolidSyslogErrorDetailNameFunction) (int32_t detail);


SolidSyslogErrorHandler

Installed via SolidSyslog_SetErrorHandler; context is passed back unchanged.

typedef void(* SolidSyslogErrorHandler) (void *context, const struct SolidSyslogErrorEvent *event);

The event is only valid for the duration of the call.

The handler runs on the task that met the fault, often part way through a SolidSyslog call, and must not call back into SolidSyslog - not SolidSyslog_Log, SolidSyslog_Service, nor any Create or Destroy. Senders and streams are not reentrant, so a call from the handler can re-enter one in the middle of an operation, and a log that fails reports again, which recurses. Record the event instead - count it, set a flag, or queue a copy of it - and act on it from your own code once the handler has returned.


Public Functions Documentation

SolidSyslogErrorEvent_DetailName

The detail's name, through the event's source, to read beside the category's.

const char * SolidSyslogErrorEvent_DetailName (
    const struct SolidSyslogErrorEvent * event
) 

NULL when there is nothing to name: no source, a source without names, or a code outside its vocabulary. The NativeCode is the platform's own and is never named.


SolidSyslog_Error

Emit an event to the installed handler.

void SolidSyslog_Error (
    enum SolidSyslogSeverity severity,
    const struct SolidSyslogErrorSource * source,
    uint16_t category,
    int32_t detail
) 

Called from inside the library at fault sites; integrators building their own Sources call it too. The event carries no native code.


SolidSyslog_ErrorWithNativeCode

As SolidSyslog_Error, with the platform's own code for the fault in the event's NativeCode and HasNativeCode set.

void SolidSyslog_ErrorWithNativeCode (
    enum SolidSyslogSeverity severity,
    const struct SolidSyslogErrorSource * source,
    uint16_t category,
    int32_t detail,
    int32_t nativeCode
) 

For a fault the platform gave no code for, call SolidSyslog_Error instead.


SolidSyslog_SetErrorHandler

Install the single global error handler.

void SolidSyslog_SetErrorHandler (
    SolidSyslogErrorHandler handler,
    void * context
) 

Intended for setup-time configuration: the slot is one shared pointer, not synchronised against concurrent SolidSyslog_Error emissions. The default handler is a silent no-op; passing handler = NULL restores it.


Macro Definition Documentation

SOLIDSYSLOG_BAD_ARGUMENT_SEVERITY

#define SOLIDSYSLOG_BAD_ARGUMENT_SEVERITY `SOLIDSYSLOG_SEVERITY_CRITICAL`

SOLIDSYSLOG_BAD_CONFIG_FATAL_SEVERITY

#define SOLIDSYSLOG_BAD_CONFIG_FATAL_SEVERITY `SOLIDSYSLOG_SEVERITY_CRITICAL`

SOLIDSYSLOG_DATAGRAM_NEXT_HOP_UNRESOLVED_SEVERITY

#define SOLIDSYSLOG_DATAGRAM_NEXT_HOP_UNRESOLVED_SEVERITY `SOLIDSYSLOG_SEVERITY_WARNING`

SOLIDSYSLOG_FILE_IO_FAILED_SEVERITY

#define SOLIDSYSLOG_FILE_IO_FAILED_SEVERITY `SOLIDSYSLOG_SEVERITY_ERROR`

SOLIDSYSLOG_NOR_FLASH_IO_FAILED_SEVERITY

#define SOLIDSYSLOG_NOR_FLASH_IO_FAILED_SEVERITY `SOLIDSYSLOG_SEVERITY_ERROR`

SOLIDSYSLOG_POOL_EXHAUSTED_SEVERITY

#define SOLIDSYSLOG_POOL_EXHAUSTED_SEVERITY `SOLIDSYSLOG_SEVERITY_CRITICAL`

SOLIDSYSLOG_STREAM_CONNECT_LOCAL_SEVERITY

#define SOLIDSYSLOG_STREAM_CONNECT_LOCAL_SEVERITY `SOLIDSYSLOG_SEVERITY_ERROR`

SOLIDSYSLOG_STREAM_CONNECT_REMOTE_SEVERITY

#define SOLIDSYSLOG_STREAM_CONNECT_REMOTE_SEVERITY `SOLIDSYSLOG_SEVERITY_WARNING`

SOLIDSYSLOG_UNKNOWN_DESTROY_SEVERITY

#define SOLIDSYSLOG_UNKNOWN_DESTROY_SEVERITY `SOLIDSYSLOG_SEVERITY_WARNING`


The documentation for this class was generated from the following file Core/Interface/SolidSyslogError.h