Create temporary file to check wifi firmware state #3
[platform/core/connectivity/net-config.git] / include / log.h
old mode 100644 (file)
new mode 100755 (executable)
index 8904a3d..e48fb5e
@@ -1,7 +1,7 @@
 /*
  * Network Configuration Module
  *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,23 +25,27 @@ extern "C" {
 #endif
 
 #include <dlog.h>
-#include <stdio.h>
 #include <string.h>
 
-#undef LOG_TAG
-#define LOG_TAG "NET_CONFIG"
+#define NETCONFIG_DEBUG_FILE (1)
 
-#define __PRT(level, format, arg...) \
+#define NETCONFIG_TAG          "NETCONFIG"
+
+void           netconfig_log(const char *format, ...);
+void           log_cleanup(void);
+
+#define __LOG(level, format, arg...) \
        do { \
-               char *ch = strrchr(__FILE__, '/'); \
-               ch = ch ? ch + 1 : __FILE__; \
-               fprintf(stderr, PACKAGE": %s:%s() "format"\n", ch, __FUNCTION__, ## arg); \
-       } while(0)
-
-#define DBG(format, arg...)            LOGD(format, ## arg)
-#define INFO(format, arg...)           LOGI(format, ## arg)
-#define WARN(format, arg...)           LOGW(format, ## arg)
-#define ERR(format, arg...)            LOGE(format, ## arg)
+               if (NETCONFIG_DEBUG_FILE) { \
+                       netconfig_log("%s(%d) "format"\n", __FUNCTION__, __LINE__,  ## arg); \
+               } \
+               SLOG(level, NETCONFIG_TAG, format, ## arg); \
+       } while (0)
+
+#define DBG(format, arg...)    __LOG(LOG_DEBUG, format, ## arg)
+#define INFO(format, arg...)   __LOG(LOG_INFO, format, ## arg)
+#define WARN(format, arg...)   __LOG(LOG_WARN, format, ## arg)
+#define ERR(format, arg...)    __LOG(LOG_ERROR, format, ## arg)
 
 #ifdef __cplusplus
 }