Added CLICON_LOG_DESTINATION and CLICON_LOG_FILE for al applications

This commit is contained in:
Olof hagsand 2024-06-19 12:28:39 +02:00
parent 26062d7003
commit 0234ed94bc
22 changed files with 498 additions and 163 deletions

View file

@ -79,9 +79,20 @@
/* Cache handle since debug calls do not have handle parameter */
static clixon_handle _debug_clixon_h = NULL;
/*! The global debug level. 0 means no debug
*
* @note There are pros and cons in having the debug state as a global variable. The
* alternative to bind it to the clicon handle (h) was considered but it limits its
* usefulness, since not all functions have access to a handle.
* A compromise solution is now in place where h can be provided in the function call, but
* tolerates NULL, in which case a cached handle is used.
*/
static int _debug_level = 0;
/*! Mapping between Clixon debug symbolic names <--> bitfields
*
* Mapping between specific bitfields and symbolic names, note only perfect matches
* @note yang_bits_map can be used as alternative but this still neeeded in bootstrapping
*/
static const map_str2int dbgmap[] = {
{"default", CLIXON_DBG_DEFAULT},
@ -152,16 +163,6 @@ clixon_debug_key_dump(FILE *f)
return -1;
}
/*! The global debug level. 0 means no debug
*
* @note There are pros and cons in having the debug state as a global variable. The
* alternative to bind it to the clicon handle (h) was considered but it limits its
* usefulness, since not all functions have access to a handle.
* A compromise solution is now in place where h can be provided in the function call, but
* tolerates NULL, in which case a cached handle is used.
*/
static int _debug_level = 0;
/*! Initialize debug messages. Set debug level.
*
* Initialize debug module. The level is used together with clixon_debug(dbglevel) calls as follows: