summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/setup.cpp2
-rw-r--r--common/tools.cpp20
2 files changed, 21 insertions, 1 deletions
diff --git a/common/setup.cpp b/common/setup.cpp
index b559aee..3d2965a 100644
--- a/common/setup.cpp
+++ b/common/setup.cpp
@@ -184,7 +184,7 @@ bool cMenuSetupUPnP::SetupParse(const char *name, const char *value, upnp::cConf
{
if(parsedArgs.find(name) != std::string::npos){
- dsyslog("UPnP\tSkipping %s=%s, was overridden in command line.", name, value);
+ LOG(1, "Skipping %s=%s, was overridden in command line.", name, value);
return true;
}
diff --git a/common/tools.cpp b/common/tools.cpp
index 1e40ccc..797dbfe 100644
--- a/common/tools.cpp
+++ b/common/tools.cpp
@@ -17,6 +17,26 @@
using namespace std;
+#ifdef DEBUG
+
+#define MESSAGE_SIZE 256
+namespace upnp {
+ void log_debug_msg(const char* file, const char* func, int line, int level, const char* msg, ...){
+ char* lvlenv = getenv("UPNP_DEBUG_LEVEL");
+ int debug_level = lvlenv ? atoi(lvlenv) : 0;
+ if(level && debug_level >= level){
+ va_list ap;
+ char message[MESSAGE_SIZE];
+
+ snprintf(message, sizeof(message), "[%s:%d] %s - %s", file, line, func, msg);
+ va_start(ap, msg);
+ vsyslog(LOG_NOTICE, message, ap);
+ va_end(ap);
+ }
+ }
+}
+#endif
+
namespace upnp {
namespace tools {