libnpupnp 4.1.0
An almost compatible successor for the Portable UPnP reference library
Macros | Typedefs | Enumerations | Functions
upnpdebug.h File Reference

libnpupnp message log definitions More...

#include "UpnpGlobal.h"
#include "upnpconfig.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define UPNP_DEFAULT_LOG_LEVEL   UPNP_ERROR
 

Typedefs

typedef enum Upnp_Module Dbg_Module
 
typedef enum Upnp_LogLevel Upnp_LogLevel
 Log verbosity level, from UPNP_CRITICAL to UPNP_ALL, in increasing order of verbosity.
 

Enumerations

enum  Upnp_Module {
  SSDP , SOAP , GENA , TPOOL ,
  MSERV , DOM , API , HTTP
}
 
enum  Upnp_LogLevel {
  UPNP_CRITICAL , UPNP_ERROR , UPNP_INFO , UPNP_DEBUG ,
  UPNP_ALL
}
 Log verbosity level, from UPNP_CRITICAL to UPNP_ALL, in increasing order of verbosity. More...
 

Functions

EXPORT_SPEC int UpnpInitLog (void)
 Initialize the log output. Can be called before UpnpInit2.
 
EXPORT_SPEC void UpnpSetLogLevel (Upnp_LogLevel log_level)
 Set the log verbosity level.
 
EXPORT_SPEC void UpnpCloseLog (void)
 Closes the log output, if appropriate.
 
EXPORT_SPEC void UpnpSetLogFileNames (const char *fileName, const char *Ignored)
 Set the name for the log file. You will then need to call UpnpInitLog to close the old file if needed, and open the new one.
 
EXPORT_SPEC FILE * UpnpGetDebugFile (Upnp_LogLevel level, Dbg_Module module)
 Use the level/module to determine if a message should be emitted.
 
EXPORT_SPEC void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
 Prints the debug statement to the current output.
 

Detailed Description

libnpupnp message log definitions

Macro Definition Documentation

◆ UPNP_DEFAULT_LOG_LEVEL

#define UPNP_DEFAULT_LOG_LEVEL   UPNP_ERROR

Default log level

Typedef Documentation

◆ Dbg_Module

typedef enum Upnp_Module Dbg_Module

Describe the code area generating the message

Enumeration Type Documentation

◆ Upnp_LogLevel

Log verbosity level, from UPNP_CRITICAL to UPNP_ALL, in increasing order of verbosity.

Enumerator
UPNP_CRITICAL 

Fatal error, the library is probably not functional any more.

UPNP_ERROR 

Regular operational, usually local error.

UPNP_INFO 

Interesting information, error caused by the remote.

UPNP_DEBUG 

Debugging traces.

UPNP_ALL 

Very verbose debugging traces.

◆ Upnp_Module

Describe the code area generating the message

Enumerator
SSDP 

SSDP (discovery) client and server.

SOAP 

SOAP (actions) client and server.

GENA 

GENA (events) client and server

TPOOL 

Thread pool

MSERV 

Network dispatcher

API 

Interface.

HTTP 

WEB server.

Function Documentation

◆ UpnpGetDebugFile()

EXPORT_SPEC FILE * UpnpGetDebugFile ( Upnp_LogLevel  level,
Dbg_Module  module 
)

Use the level/module to determine if a message should be emitted.

Returns
NULL if the log is not active for this module / level, else the output file pointer.
Parameters
[in]levelThe level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files.
[in]moduledebug will go in the name of this module.

◆ UpnpInitLog()

EXPORT_SPEC int UpnpInitLog ( void  )

Initialize the log output. Can be called before UpnpInit2.

Returns
-1 for failure or UPNP_E_SUCCESS for success.

◆ UpnpPrintf()

EXPORT_SPEC void UpnpPrintf ( Upnp_LogLevel  DLevel,
Dbg_Module  Module,
const char *  DbgFileName,
int  DbgLineNo,
const char *  FmtStr,
  ... 
)

Prints the debug statement to the current output.

Parameters
[in]DLevelMessage level, to be compared to the current verbosity.
[in]ModuleEmitting code area.
[in]DbgFileNameSource file name (usually FILE).
[in]DbgLineNoSource line number (usually LINE).
[in]FmtStrPrintf-like format specification.
[in]...Printf-like arguments.

◆ UpnpSetLogFileNames()

EXPORT_SPEC void UpnpSetLogFileNames ( const char *  fileName,
const char *  Ignored 
)

Set the name for the log file. You will then need to call UpnpInitLog to close the old file if needed, and open the new one.

Parameters
[in]fileNameName of the log file. NULL or empty to use stderr.
IgnoredIgnored, used to be a second file.

◆ UpnpSetLogLevel()

EXPORT_SPEC void UpnpSetLogLevel ( Upnp_LogLevel  log_level)

Set the log verbosity level.

Parameters
[in]log_levelLog level.