clibs
Tiny but handy utility libraries for C
Loading...
Searching...
No Matches
clibs_logging.c File Reference

Thread-local output stream implementation for clibs_logger. More...

#include "clibs_logging.h"
Include dependency graph for clibs_logging.c:

Macros

#define THREAD_LOCAL   __thread

Functions

void clibs_set_output (FILE *out, FILE *err)
 Sets thread-local output streams.
FILE * clibs_get_out (void)
 Returns the current thread-local output stream.
FILE * clibs_get_err (void)
 Returns the current thread-local error stream.

Variables

THREAD_LOCAL FILE * clibs_out = NULL
 Per-thread output stream for stdout-equivalent messages.
THREAD_LOCAL FILE * clibs_err = NULL
 Per-thread output stream for logging (stderr by default).

Detailed Description

Thread-local output stream implementation for clibs_logger.

Function Documentation

◆ clibs_get_err()

FILE * clibs_get_err ( void )

Returns the current thread-local error stream.

Gets current error stream (fallback: stderr).

Falls back to stderr if no thread-local error stream is set.

Returns
FILE* current error stream.

◆ clibs_get_out()

FILE * clibs_get_out ( void )

Returns the current thread-local output stream.

Gets current output stream (fallback: stdout).

Falls back to stdout if no thread-local output stream is set.

Returns
FILE* current output stream.

◆ clibs_set_output()

void clibs_set_output ( FILE * out,
FILE * err )

Sets thread-local output streams.

Sets thread-local output and error streams.

Parameters
outOutput stream for general messages (default fallback: stdout).
errOutput stream for log messages (default fallback: stderr).