UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
upnpdebug.hpp File Reference

Manage Debug messages with levels "critical" to "all". More...

#include <upnp.hpp>
+ Include dependency graph for upnpdebug.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UPNP_PACKET   UPNP_ERROR
 
#define UPNP_DEFAULT_LOG_LEVEL   UPNP_ALL
 

Functions

UPnPsdk_VIS int UpnpInitLog (void)
 Initialize the log files.
 
UPnPsdk_VIS void UpnpSetLogLevel (Upnp_LogLevel log_level)
 Set the log level (see Upnp_LogLevel).
 
UPnPsdk_VIS void UpnpCloseLog (void)
 Closes the log files.
 
UPnPsdk_VIS void UpnpSetLogFileNames (const char *fileName, const char *Ignored)
 Set the name for the log file. There used to be 2 separate files. The second parameter has been kept for compatibility but is ignored. Use a NULL file name for logging to stderr.
 
UPnPsdk_VIS FILE * UpnpGetDebugFile (Upnp_LogLevel DLevel, Dbg_Module Module)
 Check if the module is turned on for debug and returns the file descriptor corresponding to the debug level. .
 
UPnPsdk_VIS void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
 Prints the debug statement.
 
enum  Upnp_Module {
  SSDP , SOAP , GENA , TPOOL ,
  MSERV , DOM , API , HTTP
}
 Only debug messages from this program module. More...
 
typedef enum Upnp_Module Dbg_Module
 Only debug messages from this program module.
 
enum  Upnp_LogLevel_e { UPNP_CRITICAL , UPNP_ERROR , UPNP_INFO , UPNP_ALL }
 Upnp_LogLevel. More...
 
typedef enum Upnp_LogLevel_e Upnp_LogLevel
 Upnp_LogLevel.
 

Detailed Description

Manage Debug messages with levels "critical" to "all".

Definition in file upnpdebug.hpp.

Macro Definition Documentation

◆ UPNP_PACKET

#define UPNP_PACKET   UPNP_ERROR

UPNP_PACKET probably resulted from a confusion between module and level and was only used by a few messages in ssdp_device.c (they have been moved to INFO). Kept for compatibility, don't use for new messages.

Definition at line 99 of file upnpdebug.hpp.

◆ UPNP_DEFAULT_LOG_LEVEL

#define UPNP_DEFAULT_LOG_LEVEL   UPNP_ALL

Default log level : see Upnp_LogLevel

Definition at line 102 of file upnpdebug.hpp.

Typedef Documentation

◆ Upnp_LogLevel

Upnp_LogLevel.

The user has the option to select 4 different types of debugging levels, see UpnpSetLogLevel. The critical level will show only those messages which can halt the normal processing of the library, like memory allocation errors. The remaining three levels are just for debugging purposes. Error will show recoverable errors. Info Level displays the other important operational information regarding the working of the library. If the user selects All, then the library displays all the debugging information that it has.

  • UPNP_CRITICAL [0]
  • UPNP_ERROR [1]
  • UPNP_INFO [2]
  • UPNP_ALL [3]

Enumeration Type Documentation

◆ Upnp_Module

Only debug messages from this program module.

Definition at line 59 of file upnpdebug.hpp.

◆ Upnp_LogLevel_e

Upnp_LogLevel.

The user has the option to select 4 different types of debugging levels, see UpnpSetLogLevel. The critical level will show only those messages which can halt the normal processing of the library, like memory allocation errors. The remaining three levels are just for debugging purposes. Error will show recoverable errors. Info Level displays the other important operational information regarding the working of the library. If the user selects All, then the library displays all the debugging information that it has.

  • UPNP_CRITICAL [0]
  • UPNP_ERROR [1]
  • UPNP_INFO [2]
  • UPNP_ALL [3]

Definition at line 88 of file upnpdebug.hpp.

Function Documentation

◆ UpnpInitLog()

UPnPsdk_VIS int UpnpInitLog ( void  )

Initialize the log files.

Returns
-1 if fails or UPNP_E_SUCCESS if succeeds.

Definition at line 77 of file upnpdebug.cpp.

+ Here is the caller graph for this function:

◆ UpnpSetLogLevel()

UPnPsdk_VIS void UpnpSetLogLevel ( Upnp_LogLevel  log_level)

Set the log level (see Upnp_LogLevel).

Parameters
[in]log_levelLog level.

Definition at line 110 of file upnpdebug.cpp.

◆ UpnpCloseLog()

UPnPsdk_VIS void UpnpCloseLog ( void  )

Closes the log files.

Definition at line 116 of file upnpdebug.cpp.

+ Here is the caller graph for this function:

◆ UpnpSetLogFileNames()

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

Set the name for the log file. There used to be 2 separate files. The second parameter has been kept for compatibility but is ignored. Use a NULL file name for logging to stderr.

Parameters
[in]fileNameName of the log file.
[in]IgnoredIgnored.

Definition at line 138 of file upnpdebug.cpp.

◆ UpnpGetDebugFile()

UPnPsdk_VIS FILE * UpnpGetDebugFile ( Upnp_LogLevel  DLevel,
Dbg_Module  Module 
)

Check if the module is turned on for debug and returns the file descriptor corresponding to the debug level. .

Returns
nullptr if the module is turn off for debug otherwise returns the right FILE pointer.
Parameters
[in]DLevelThe 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.

Definition at line 279 of file upnpdebug.cpp.

+ Here is the call graph for this function:

◆ UpnpPrintf()

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

Prints the debug statement.

Prints either on the standard output or log file along with the information from where this debug statement is coming.

Parameters
[in]DLevelThe 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.
[in]DbgFileNameName of the file from where debug statement is coming.
[in]DbgLineNoLine number of the file from where debug statement is coming.
[in]FmtStrPrintf like format specification.
[in]...Printf like Variable number of arguments that will go in the debug statement.

Definition at line 244 of file upnpdebug.cpp.

+ Here is the call graph for this function: