configure libimcv debug output via strongswan.conf
This commit is contained in:
+17
-9
@@ -19,30 +19,32 @@
|
|||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#define IMCV_DEBUG_LEVEL 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference count for IMC/IMV instances
|
* Reference count for IMC/IMV instances
|
||||||
*/
|
*/
|
||||||
refcount_t ref = 0;
|
refcount_t ref = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global configuration of libimcv dbg function
|
* Global configuration of imcv dbg function
|
||||||
*/
|
*/
|
||||||
static int debug_level = 3;
|
static int imcv_debug_level;
|
||||||
static bool stderr_quiet = FALSE;
|
static bool imcv_stderr_quiet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* libimvc dbg function
|
* imvc dbg function
|
||||||
*/
|
*/
|
||||||
static void libimcv_dbg(debug_t group, level_t level, char *fmt, ...)
|
static void imcv_dbg(debug_t group, level_t level, char *fmt, ...)
|
||||||
{
|
{
|
||||||
int priority = LOG_INFO;
|
int priority = LOG_INFO;
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
char *current = buffer, *next;
|
char *current = buffer, *next;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (level <= debug_level)
|
if (level <= imcv_debug_level)
|
||||||
{
|
{
|
||||||
if (!stderr_quiet)
|
if (!imcv_stderr_quiet)
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vfprintf(stderr, fmt, args);
|
vfprintf(stderr, fmt, args);
|
||||||
@@ -97,8 +99,14 @@ bool libimcv_init(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable libimcv debugging hook */
|
/* set the debug level and stderr output */
|
||||||
dbg = libimcv_dbg;
|
imcv_debug_level = lib->settings->get_int(lib->settings,
|
||||||
|
"libimcv.debug_level", IMCV_DEBUG_LEVEL);
|
||||||
|
imcv_stderr_quiet = lib->settings->get_int(lib->settings,
|
||||||
|
"libimcv.debug_level", FALSE);
|
||||||
|
|
||||||
|
/* activate the imcv debugging hook */
|
||||||
|
dbg = imcv_dbg;
|
||||||
openlog("imcv", 0, LOG_DAEMON);
|
openlog("imcv", 0, LOG_DAEMON);
|
||||||
|
|
||||||
DBG1(DBG_LIB, "libimcv initialized");
|
DBG1(DBG_LIB, "libimcv initialized");
|
||||||
|
|||||||
Reference in New Issue
Block a user