FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_log::anonymous_namespace{log.hpp} Namespace Reference

Classes

class  Logger
 

Functions

void fork_handler_child ()
 Fork handler that resets the logger in child processes.
 

Variables

thread_local Logger logger
 Thread-local logger instance.
 

Function Documentation

◆ fork_handler_child()

void ns_log::anonymous_namespace{log.hpp}::fork_handler_child ( )

Fork handler that resets the logger in child processes.

This function is registered via pthread_atfork() and automatically executes in child processes after fork(). It resets the logger to a fresh state with /dev/null sink, preventing file descriptor sharing issues.

NOTE: m_pid is intentionally NOT updated here. This allows child processes to detect they are forks (getpid() != m_pid) and log their PID instead of file location.

Definition at line 218 of file log.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ logger

thread_local Logger ns_log::anonymous_namespace{log.hpp}::logger

Thread-local logger instance.

Each thread in the process gets its own independent Logger instance. Automatically reset to default state after fork() via pthread_atfork().

Definition at line 188 of file log.hpp.