libnpupnp  4.1.0
An almost compatible successor for the Portable UPnP reference library
upnpdebug.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (c) 2000-2003 Intel Corporation
4  * Copyright (c) 2006 RĂ©mi Turboult <r3mi@users.sourceforge.net>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  * - Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  * - Neither name of Intel Corporation nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  ******************************************************************************/
32 
33 #ifndef UPNP_DEBUG_H
34 #define UPNP_DEBUG_H
35 
39 #include "UpnpGlobal.h"
40 #include "upnpconfig.h"
41 
42 #include <stdio.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
49 typedef enum Upnp_Module {
60  DOM,
62  API,
64  HTTP
66 
70 typedef enum Upnp_LogLevel {
80  UPNP_ALL
82 
84 #define UPNP_DEFAULT_LOG_LEVEL UPNP_ERROR
85 
90 EXPORT_SPEC int UpnpInitLog(void);
91 
93 EXPORT_SPEC void UpnpSetLogLevel(
95  Upnp_LogLevel log_level);
96 
98 EXPORT_SPEC void UpnpCloseLog(void);
99 
102 EXPORT_SPEC void UpnpSetLogFileNames(
104  const char *fileName,
106  const char *Ignored);
107 
114 EXPORT_SPEC FILE *UpnpGetDebugFile(
117  Upnp_LogLevel level,
119  Dbg_Module module);
120 
121 /* This enables printf like format checking by the compiler. */
122 #ifndef _MSC_VER
123 #ifdef __MINGW32__
124  [[gnu::format(__MINGW_PRINTF_FORMAT, 5, 6)]]
125 #else
126  [[gnu::format(printf, 5, 6)]]
127 #endif
128 #endif // !_MSC_VER
130 EXPORT_SPEC void UpnpPrintf(
132  Upnp_LogLevel DLevel,
134  Dbg_Module Module,
136  const char *DbgFileName,
138  int DbgLineNo,
140  const char *FmtStr,
142  ...)
143  ;
144 
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* UPNP_DEBUG_H */
enum Upnp_Module Dbg_Module
Upnp_Module
Definition: upnpdebug.h:49
@ GENA
Definition: upnpdebug.h:55
@ MSERV
Definition: upnpdebug.h:59
@ HTTP
Definition: upnpdebug.h:64
@ SSDP
Definition: upnpdebug.h:51
@ API
Definition: upnpdebug.h:62
@ SOAP
Definition: upnpdebug.h:53
@ TPOOL
Definition: upnpdebug.h:57
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...
EXPORT_SPEC void UpnpCloseLog(void)
Closes the log output, if appropriate.
EXPORT_SPEC void UpnpSetLogLevel(Upnp_LogLevel log_level)
Set the log verbosity level.
EXPORT_SPEC FILE * UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
Use the level/module to determine if a message should be emitted.
Upnp_LogLevel
Log verbosity level, from UPNP_CRITICAL to UPNP_ALL, in increasing order of verbosity.
Definition: upnpdebug.h:70
@ UPNP_DEBUG
Definition: upnpdebug.h:78
@ UPNP_ERROR
Definition: upnpdebug.h:74
@ UPNP_INFO
Definition: upnpdebug.h:76
@ UPNP_CRITICAL
Definition: upnpdebug.h:72
@ UPNP_ALL
Definition: upnpdebug.h:80
EXPORT_SPEC int UpnpInitLog(void)
Initialize the log output. Can be called before UpnpInit2.