Nilorea Library
C utilities for networking, threading, graphics
LOGGING NODUP: no duplicate logging to console, to file, to syslog

Macros

#define n_nodup_log(__LEVEL__, ...)
 nodup log macro helper More...
 
#define n_nodup_log_indexed(__LEVEL__, __PREF__, ...)
 nodup log indexed macro helper More...
 

Functions

void _n_nodup_log (int LEVEL, const char *file, const char *func, int line, const char *format,...)
 Logging function. More...
 
void _n_nodup_log_indexed (int LEVEL, const char *prefix, const char *file, const char *func, int line, const char *format,...)
 Logging function. More...
 
int close_nodup_log ()
 Empty nodup logtable and close the no duplicate logging session. More...
 
int dump_nodup_log (char *file)
 Dump the duplicate error log hash table in a file. More...
 
int empty_nodup_table ()
 Empty the nodup internal table. More...
 
int init_nodup_log (int max)
 initialize the no duplicate logging system More...
 

Detailed Description

Macro Definition Documentation

◆ n_nodup_log

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

nodup log macro helper

Examples
ex_log.c.

Definition at line 34 of file n_nodup_log.h.

◆ n_nodup_log_indexed

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

nodup log indexed macro helper

Examples
ex_log.c.

Definition at line 41 of file n_nodup_log.h.

Function Documentation

◆ _n_nodup_log()

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

Logging function.

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

Parameters
LEVELLogging level
fileFile containing the emmited log
funcFunction emmiting the log
lineLine of the log
formatFormat and string of the log, printf style

Definition at line 220 of file n_nodup_log.c.

References __n_assert, _n_log(), _n_nodup_table, check_n_log_dup(), Free, get_nodup_key(), ht_get_node(), ht_put_string(), LOG_ERR, n_log, and vasprintf().

+ Here is the call graph for this 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,
  ... 
)

Logging function.

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

Parameters
LEVELLogging level
prefixprefix to subgroup logs
fileFile containing the emmited log
funcFunction emmiting the log
lineLine of the log
formatFormat and string of the log, printf style

Definition at line 288 of file n_nodup_log.c.

References _n_log(), _n_nodup_table, check_n_log_dup_indexed(), Free, get_nodup_indexed_key(), ht_get_node(), ht_put_string(), LOG_ERR, n_log, and vasprintf().

+ Here is the call graph for this function:

◆ close_nodup_log()

int close_nodup_log ( )

Empty nodup logtable and close the no duplicate logging session.

Returns
TRUE or FALSE

Definition at line 79 of file n_nodup_log.c.

References __n_assert, _n_nodup_table, and destroy_ht().

+ Here is the call graph for this function:

◆ dump_nodup_log()

int dump_nodup_log ( char *  file)

Dump the duplicate error log hash table in a file.

Parameters
fileThe path and filename to the dump file
Returns
TRUE or FALSE

Definition at line 350 of file n_nodup_log.c.

References __n_assert, _n_nodup_table, Free, list_foreach, LOG_DEBUG, LOG_ERR, n_log, and strprintf.

◆ empty_nodup_table()

int empty_nodup_table ( )

Empty the nodup internal table.

Returns
TRUE or FALSE

Definition at line 67 of file n_nodup_log.c.

References __n_assert, _n_nodup_table, and empty_ht().

+ Here is the call graph for this function:

◆ init_nodup_log()

int init_nodup_log ( int  max)

initialize the no duplicate logging system

Parameters
maxthe max size of the internal hash table. Leave it to zero or negative to keep the internal value in use ( 1024 )
Returns
TRUE or FALSE

Definition at line 36 of file n_nodup_log.c.

References _n_nodup_table, LOG_DEBUG, LOG_ERR, n_log, and new_ht().

+ Here is the call graph for this function: