libUPnP
1.8.0
|
#include "config.h"
#include "ithread.h"
#include "ixml.h"
#include "upnp.h"
#include "upnpdebug.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Macros | |
#define | NLINES 2 |
#define | MAX_LINE_SIZE 512 |
#define | NUMBER_OF_STARS 80 |
Functions | |
int | UpnpInitLog (void) |
Initialize the log files. More... | |
void | UpnpSetLogLevel (Upnp_LogLevel log_level) |
Set the log level (see Upnp_LogLevel ). More... | |
void | UpnpCloseLog (void) |
Closes the log files. More... | |
void | UpnpSetLogFileNames (const char *ErrFileName, const char *InfoFileName) |
Set the name for error and information files, respectively. More... | |
int | DebugAtThisLevel (Upnp_LogLevel DLevel, Dbg_Module Module) |
Returns true if debug output should be done in this module. More... | |
void | UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...) |
Prints the debug statement either on the standard output or log file along with the information from where this debug statement is coming. More... | |
FILE * | GetDebugFile (Upnp_LogLevel DLevel, Dbg_Module Module) |
void | UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo) |
Writes the file name and file number from where debug statement is coming to the log file. More... | |
void | UpnpDisplayBanner (FILE *fd, const char **lines, size_t size, size_t starLength) |
Writes the buffer in the file as per the requested banner. More... | |
Variables | |
static ithread_mutex_t | GlobalDebugMutex |
static Upnp_LogLevel | g_log_level = UPNP_DEFAULT_LOG_LEVEL |
static FILE * | ErrFileHnd = NULL |
static FILE * | InfoFileHnd = NULL |
static const char * | errFileName = "IUpnpErrFile.txt" |
static const char * | infoFileName = "IUpnpInfoFile.txt" |
int DebugAtThisLevel | ( | Upnp_LogLevel | DLevel, |
Dbg_Module | Module | ||
) |
Returns true if debug output should be done in this module.
[in] | DLevel | The level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files. |
[in] | Module | Debug will go in the name of this module. |
References g_log_level.
Referenced by UpnpPrintf().
void UpnpCloseLog | ( | void | ) |
Closes the log files.
References ErrFileHnd, and InfoFileHnd.
void UpnpDisplayBanner | ( | FILE * | fd, |
const char ** | lines, | ||
size_t | size, | ||
size_t | starLength | ||
) |
Writes the buffer in the file as per the requested banner.
[in] | fd | file descriptor where the banner will be written. |
[in] | lines | The buffer that will be written. |
[in] | size | Size of the buffer. |
[in] | starLength | This parameter provides the width of the banner. |
void UpnpDisplayFileAndLine | ( | FILE * | fd, |
const char * | DbgFileName, | ||
int | DbgLineNo | ||
) |
Writes the file name and file number from where debug statement is coming to the log file.
[in] | fd | File descriptor where line number and file name will be written. |
[in] | DbgFileName | Name of the file. |
[in] | DbgLineNo | Line number of the file. |
int UpnpInitLog | ( | void | ) |
Initialize the log files.
Referenced by UpnpInitPreamble().
void UpnpPrintf | ( | Upnp_LogLevel | DLevel, |
Dbg_Module | Module, | ||
const char * | DbgFileName, | ||
int | DbgLineNo, | ||
const char * | FmtStr, | ||
... | |||
) |
Prints the debug statement either on the standard output or log file along with the information from where this debug statement is coming.
[in] | DLevel | The level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files. |
[in] | Module | debug will go in the name of this module. |
[in] | DbgFileName | Name of the file from where debug statement is coming. |
[in] | DbgLineNo | Line number of the file from where debug statement is coming. |
[in] | FmtStr | Printf like format specification. |
References DebugAtThisLevel().
Referenced by FreeHandle(), gena_process_subscription_request(), get_port(), getlocalhostname(), http_MakeMessage(), notify_send_and_recv(), printService(), printServiceList(), printServiceTable(), PrintThreadPoolStats(), UpnpAcceptSubscription(), UpnpAcceptSubscriptionExt(), UpnpFinish(), UpnpGetIfInfo(), UpnpGetServiceVarStatus(), UpnpGetServiceVarStatusAsync(), UpnpInitPreamble(), UpnpInitStartServers(), UpnpNotify(), UpnpNotifyExt(), UpnpRegisterClient(), UpnpRegisterRootDevice3(), UpnpRenewSubscription(), UpnpRenewSubscriptionAsync(), UpnpSearchAsync(), UpnpSendAction(), UpnpSendActionAsync(), UpnpSendActionEx(), UpnpSendActionExAsync(), UpnpSendAdvertisement(), UpnpSendAdvertisementLowPower(), UpnpSetMaxSubscriptions(), UpnpSetMaxSubscriptionTimeOut(), UpnpSubscribe(), UpnpSubscribeAsync(), UpnpThreadDistribution(), UpnpUnRegisterClient(), UpnpUnRegisterRootDevice(), UpnpUnRegisterRootDeviceLowPower(), UpnpUnSubscribe(), and UpnpUnSubscribeAsync().
void UpnpSetLogFileNames | ( | const char * | ErrFileName, |
const char * | InfoFileName | ||
) |
Set the name for error and information files, respectively.
[in] | ErrFileName | Name of the error file. |
[in] | InfoFileName | Name of the information file. |
References errFileName, and infoFileName.
void UpnpSetLogLevel | ( | Upnp_LogLevel | log_level | ) |
|
static |
File handle for the error log file
Referenced by UpnpCloseLog().
|
static |
Name of the error file
Referenced by UpnpSetLogFileNames().
|
static |
Global log level
Referenced by DebugAtThisLevel(), and UpnpSetLogLevel().
|
static |
Mutex to synchronize all the log file opeartions in the debug mode
|
static |
File handle for the information log file
Referenced by UpnpCloseLog().
|
static |
Name of the info file
Referenced by UpnpSetLogFileNames().