6 Module LOGNODUP
gullradriel edited this page 2026-10-29 20:54:40 +01:00

LOGGING NODUP: no duplicate logging to console, to file, to syslog

Functions

Name
int init_nodup_log(size_t max)
init the nodup log internal hash table
int empty_nodup_table()
empty the nodup table
int dump_nodup_log(char * file)
dump the nodup log hash table to a file in human-readable form
int close_nodup_log()
close the nodup log session
void _n_nodup_log_indexed(int LEVEL, const char * prefix, const char * file, const char * func, int line, const char * format, ... )
log a message only once per unique prefix and location
void _n_nodup_log(int LEVEL, const char * file, const char * func, int line, const char * format, ... )
log a message only once per unique location

Defines

Name
n_nodup_log_indexed(LEVEL, PREF, ...)
nodup log indexed macro helper
n_nodup_log(LEVEL, ...)
nodup log macro helper

Functions Documentation

function init_nodup_log

int init_nodup_log(
    size_t max
)

init the nodup log internal hash table

Parameters:

  • max the max size of the internal hash table. Leave it to zero to keep the internal value in use ( 1024 )

Return: TRUE or FALSE

initialize the no duplicate logging system

init the nodup log internal hash table

function empty_nodup_table

int empty_nodup_table()

empty the nodup table

Return: TRUE or FALSE

Empty the nodup internal table.

empty the nodup table

function dump_nodup_log

int dump_nodup_log(
    char * file
)

dump the nodup log hash table to a file in human-readable form

Parameters:

  • file The path and filename to the dump file

Return: TRUE or FALSE

Dump the duplicate error log hash table in a file The table is first written to a temporary file which is then renamed to the final destination and permissions set via rename() and chmod().

dump the nodup log hash table to a file in human-readable form

function close_nodup_log

int close_nodup_log()

close the nodup log session

Return: TRUE or FALSE

Empty nodup logtable and close the no duplicate logging session.

close the nodup log session

function _n_nodup_log_indexed

void _n_nodup_log_indexed(
    int LEVEL,
    const char * prefix,
    const char * file,
    const char * func,
    int line,
    const char * format,
    ... 
)

log a message only once per unique prefix and location

Parameters:

  • LEVEL Logging level
  • prefix prefix to subgroup logs
  • file File containing the emitted log
  • func Function emitting the log
  • line Line of the log
  • format Format and string of the log, printf style

Logging function.

log a message only once per unique prefix and location

log( level , const char *format , ... ) is a macro around _log

function _n_nodup_log

void _n_nodup_log(
    int LEVEL,
    const char * file,
    const char * func,
    int line,
    const char * format,
    ... 
)

log a message only once per unique location

Parameters:

  • LEVEL Logging level
  • file File containing the emitted log
  • func Function emitting the log
  • line Line of the log
  • format Format and string of the log, printf style

Logging function.

log a message only once per unique location

log( level , const char *format , ... ) is a macro around _log

Macros Documentation

define n_nodup_log_indexed

#define n_nodup_log_indexed(
    __LEVEL__,
    __PREF__,
    ...
)
do {                                                                                      \
    _n_nodup_log_indexed(__LEVEL__, __PREF__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
} while (0)

nodup log indexed macro helper

define n_nodup_log

#define n_nodup_log(
    __LEVEL__,
    ...
)
do {                                                                    \
    _n_nodup_log(__LEVEL__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
} while (0)

nodup log macro helper