SELKIELogger  1.0.0
Logger: Global triggers/signal handlers
Collaboration diagram for Logger: Global triggers/signal handlers:

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...
 

Detailed Description

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.

Function Documentation

◆ signalPause()

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.

Parameters
[in]signnumSignal number - ignored

Definition at line 87 of file LoggerSignals.c.

◆ signalRotate()

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.

Parameters
[in]signnumSignal number - ignored

Definition at line 73 of file LoggerSignals.c.

◆ signalShutdown()

void signalShutdown ( int  signnum)

Set safe shutdown flag.

Called as a signal handler.

By default, this is hooked to SIGINT, SIGQUIT and SIGRTMIN + 1

Parameters
[in]signnumSignal number - ignored

Signal handler - sets shutdown flag

Signal handler - sets shutdown flag

Definition at line 59 of file LoggerSignals.c.

◆ signalUnpause()

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.

Parameters
[in]signnumSignal number - ignored

Definition at line 100 of file LoggerSignals.c.

Variable Documentation

◆ pauseLog

atomic_bool pauseLog
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.

◆ rotateNow

atomic_bool rotateNow
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.

◆ shutdownFlag

atomic_bool shutdownFlag
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.