Struct SolidSyslogConfig¶
#include <SolidSyslogConfig.h>
struct SolidSyslogConfig
{
struct SolidSyslogBuffer* Buffer;
struct SolidSyslogSender* Sender;
SolidSyslogClockFunction Clock;
SolidSyslogHeaderFieldFunction GetHostname;
void* GetHostnameContext;
SolidSyslogHeaderFieldFunction GetAppName;
void* GetAppNameContext;
SolidSyslogHeaderFieldFunction GetProcessId;
void* GetProcessIdContext;
struct SolidSyslogStore* Store;
struct SolidSyslogStructuredData** Sd;
size_t SdCount;
SolidSyslogDiscardPolicyFunction GetDiscardPolicy;
void* DiscardPolicyContext;
SolidSyslogHaltCallback OnHalt;
void* HaltContext;
struct SolidSyslogScratch* Scratch;
SolidSyslogEventReportingFunction IsEventReportingOn;
void* EventReportingContext;
SolidSyslogDestinationKnownFunction IsDestinationKnown;
void* DestinationKnownContext;
SolidSyslogCaptureStateFunction GetCaptureState;
void* CaptureStateContext;
};
Detailed Description¶
Wiring for SolidSyslog_Create.
NULL is safe for any field: Buffer, Sender, and Store fall back to their Null object and report an error (a no-op unless an error handler is installed; inject the Null* object instead to stay silent), while the callbacks fall back to nil defaults and Scratch to the stack scratch, with no error. Whatever you do provide must outlive the created handle; the config struct itself is only read during Create and may be transient.
Public Attributes Documentation¶
Buffer¶
Also sets Log's blocking behaviour (inline vs enqueued).
CaptureStateContext¶
Passed back to GetCaptureState unchanged.
Clock¶
NULL leaves timestamps at the RFC 5424 nil value.
DestinationKnownContext¶
Passed back to IsDestinationKnown unchanged.
DiscardPolicyContext¶
EventReportingContext¶
Passed back to IsEventReportingOn unchanged.
GetAppName¶
RFC 5424 APP-NAME; NULL emits "-".
GetAppNameContext¶
Passed back to the callback unchanged.
GetCaptureState¶
Asked, with CaptureStateContext, on the task that logs, at each Log before the record is formatted, and on the task that calls SolidSyslog_Service, at the start of each pass.
Undecided is the device before it has read its configuration: Log formats and enqueues as usual, and the pass reads nothing from the buffer, makes no report, and returns SOLIDSYSLOG_SERVICE_BLOCKED; the store still sends what it holds, under IsDestinationKnown. On captures. Off is the user's opt-out: Log drops the record unformatted, so it consumes no sequence number and is not reported as a loss, and a pass that finds the device off, never having found it on, discards the records the buffer holds, since they were logged while undecided on a device whose user had opted out, and makes no report of the library's own, as while undecided, so a device that powers up off adds no record to its store. The discard is the pass's: a device that answers on again before a pass has found it off keeps those records. Once the device has answered on, at a Log or a pass, nothing in the buffer is ever discarded: a pass that finds it off drains as usual, so what was logged before the opt-out, the deactivation record among it, is delivered. Log the deactivation and then answer off, from one task; answer on and then log the reactivation. The records held while undecided are in RAM alone, under the buffer's discard policy. SolidSyslogPassthroughBuffer sends on the task that logs and cannot hold. NULL means on.
GetDiscardPolicy¶
Asked, with DiscardPolicyContext, when Service has to decide what a refused record means: under Halt the logger stops moving records, and under Oldest it drops a record from the buffer that it holds for the sender once the buffer has filled behind it; a report of one of the library's own events keeps its place.
Give the store and the buffer the same function at their own Create; the logger's answer decides those two things, the store's and the buffer's whether each evicts or refuses, and nothing checks that they agree. NULL applies Oldest.
GetHostname¶
RFC 5424 HOSTNAME; NULL emits "-".
GetHostnameContext¶
Passed back to the callback unchanged.
GetProcessId¶
RFC 5424 PROCID; NULL emits "-".
GetProcessIdContext¶
Passed back to the callback unchanged.
HaltContext¶
Passed back to OnHalt unchanged.
IsDestinationKnown¶
Asked, with DestinationKnownContext, on the task that calls SolidSyslog_Service, on each pass that has a record to offer to the sender, before it is offered.
False holds the record back: the pass still drains the buffer into the store, offers nothing to the sender, so no delivery, resolve or connection event is raised, and returns what it would for a sender that refuses; a later pass whose answer is true sends. The store's own events are raised as they would be for a collector that is down, and so is the buffer's discard policy when the store keeps nothing. The question is about the device, not the collector: whether it yet knows where the collector is, for a destination read from configuration that arrives after the first events are logged. A collector that is known but unreachable is what the sender's delivery events report. SolidSyslogPassthroughBuffer sends on the task that logs and never reaches this gate. NULL means known.
IsEventReportingOn¶
Asked, with EventReportingContext, on the task that calls SolidSyslog_Service, each time Service is about to report one of the library's own events: the logger holds no record and an event is waiting.
False leaves that event, and any the pass had still to report, waiting for a pass when the answer is true, and lets this pass return SOLIDSYSLOG_SERVICE_IDLE whatever is raised later in it. A loop waiting on IDLE is not woken when the answer turns true; the next Log, or a poll, makes the report. A report already made is not held back. Because it is asked rather than read once at Create, a device can turn reporting off and on while it runs. NULL means on.
OnHalt¶
Optional: nothing is called when NULL.
Scratch¶
Where Log formats a message: on the stack of the task that logs ( SolidSyslogStackScratch_Get() , and what NULL means) or in one buffer shared under a mutex (SolidSyslogSharedScratch_Create).
Sd¶
Optional: per-instance SD-ELEMENTs, before any per-message SD.
SdCount¶
Sender¶
Store¶
NULL (or SolidSyslogNullStore_Get() ) means no store-and-forward.
The documentation for this class was generated from the following file Core/Interface/SolidSyslogConfig.h