SELKIELogger
1.0.0
|
Functions | |
void | signalShutdown (int signnum) |
Set safe shutdown flag. More... | |
void | signalRotate (int signnum) |
Set log rotate flag. More... | |
void | signalPause (int signnum) |
Set logger pause flag. More... | |
void | signalUnpause (int signnum) |
Clear logger pause flag. More... | |
Variables | |
atomic_bool | shutdownFlag |
Trigger clean software shutdown. More... | |
atomic_bool | rotateNow |
Trigger immediate log rotation. More... | |
atomic_bool | pauseLog |
Pause logging. More... | |
In order to allow the behaviour of the main logging thread to be controlled, it will check the state of defined trigger variables and react accordingly. These variables can be set by signal handlers, input threads or by conditions detected in the main logging loop.
The signal handlers are hooked to multiple signals. The SIGRTMIN + n flags are used to be independent of system defined meanings, while other signals are hooked to match traditional service behaviours.
void signalPause | ( | int | signnum | ) |
Set logger pause flag.
Called as a signal handler.
By default, this is hooked to SIGRTMIN + 3
The pause flag can only be cleared by the unpause signal handler, or during shutdown. Calling this function while already paused will have no additional effect.
[in] | signnum | Signal number - ignored |
Definition at line 87 of file LoggerSignals.c.
void signalRotate | ( | int | signnum | ) |
Set log rotate flag.
Called as a signal handler.
By default, this is hooked to SIGUSR1, SIGHUP and SIGRTMIN+2
This flag will be cleared by the main loop once logs have been successfully rotated. If the logger is paused, logs will be rotated when resumed.
[in] | signnum | Signal number - ignored |
Definition at line 73 of file LoggerSignals.c.
void signalShutdown | ( | int | signnum | ) |
Set safe shutdown flag.
Called as a signal handler.
By default, this is hooked to SIGINT, SIGQUIT and SIGRTMIN + 1
[in] | signnum | Signal number - ignored |
Signal handler - sets shutdown flag
Signal handler - sets shutdown flag
Definition at line 59 of file LoggerSignals.c.
void signalUnpause | ( | int | signnum | ) |
Clear logger pause flag.
Called as a signal handler.
By default, this is hooked to SIGRTMIN + 4
Calling this while the logger is not paused has no effect.
[in] | signnum | Signal number - ignored |
Definition at line 100 of file LoggerSignals.c.
|
extern |
Pause logging.
Will not rotate or close log files, but will stop reading from inputs while this variable is set.
Definition at line 50 of file LoggerSignals.c.
|
extern |
Trigger immediate log rotation.
Will be reset once files have been rotated, which may not happen immediately if the logger is paused.
Definition at line 42 of file LoggerSignals.c.
|
extern |
Trigger clean software shutdown.
Will end any running _logging functions and the main loop in Logger.c
For obvious reasons, this flag is never reset.
Definition at line 34 of file LoggerSignals.c.