mUPnP for C
log.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <mupnp/util/log.h>
#include <mupnp/util/mutex.h>

Data Structures

struct  FdList
 

Functions

static void log_init_with_defaults (void)
 
static const char * map_severity (int severity)
 
int mupnp_log_add_target (char *target, int mask)
 
int mupnp_log_clear_targets (void)
 
void mupnp_log_set_separator (char *s)
 
void mupnp_log_print (int severity, const char *file, int lineN, const char *function, const char *format,...)
 

Variables

static const char * sevErrorS = SEV_ERROR_S
 
static const char * sevWarningS = SEV_WARNING_S
 
static const char * sevInfoS = SEV_INFO_S
 
static const char * sevDebugL1S = SEV_DEBUG_L1_S
 
static const char * sevDebugL2S = SEV_DEBUG_L2_S
 
static const char * sevDebugL3S = SEV_DEBUG_L3_S
 
static const char * sevDebugL4S = SEV_DEBUG_L4_S
 
static const char * sevDebugL5S = SEV_DEBUG_L5_S
 
static const char * sevUnknownS = SEV_UNKNOWN_S
 
static struct FdListdescriptorList = NULL
 
static int initialized = 0
 
static char * separator = NULL
 
static mUpnpMutexprintMutex = NULL
 

Function Documentation

◆ log_init_with_defaults()

static void log_init_with_defaults ( void )
static

◆ map_severity()

static const char * map_severity ( int severity)
static

◆ mupnp_log_add_target()

int mupnp_log_add_target ( char * target,
int mask )

Add new logging target

Parameters
targetString identifying the logging target (Currently stdout|stderr|FILENAME)
maskBitmask defining what messages are to be printed into this target

◆ mupnp_log_clear_targets()

int mupnp_log_clear_targets ( void )

Clear target list

◆ mupnp_log_print()

void mupnp_log_print ( int severity,
const char * file,
int lineN,
const char * function,
const char * format,
... )

Multiplex log messages into different targets (streams), should be used via convenience macros

Parameters
severityMessage severity
fileFile name where the function is called
line_nLine number where the function is called
functionFunction name where this function is called
formatFormat string for the actual log message
...Possible parameters for the format string

◆ mupnp_log_set_separator()

void mupnp_log_set_separator ( char * s)

Set log item separator

Parameters
sString to use as a log item separator

Variable Documentation

◆ descriptorList

struct FdList* descriptorList = NULL
static

◆ initialized

int initialized = 0
static

◆ printMutex

mUpnpMutex* printMutex = NULL
static

◆ separator

char* separator = NULL
static

◆ sevDebugL1S

const char* sevDebugL1S = SEV_DEBUG_L1_S
static

◆ sevDebugL2S

const char* sevDebugL2S = SEV_DEBUG_L2_S
static

◆ sevDebugL3S

const char* sevDebugL3S = SEV_DEBUG_L3_S
static

◆ sevDebugL4S

const char* sevDebugL4S = SEV_DEBUG_L4_S
static

◆ sevDebugL5S

const char* sevDebugL5S = SEV_DEBUG_L5_S
static

◆ sevErrorS

const char* sevErrorS = SEV_ERROR_S
static

◆ sevInfoS

const char* sevInfoS = SEV_INFO_S
static

◆ sevUnknownS

const char* sevUnknownS = SEV_UNKNOWN_S
static

◆ sevWarningS

const char* sevWarningS = SEV_WARNING_S
static