*/
#include <glib.h>
-#include <time.h>
+#include <sys/time.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <tzplatform_config.h>
#include "log.h"
-#define LOG_FILE_PATH "/opt/usr/data/network/netconfig.log"
+#define LOG_FILE_PATH tzplatform_mkpath(TZ_USER_DATA, "/network/netconfig.log")
#define MAX_LOG_SIZE 1 * 1024 * 1024
#define MAX_LOG_COUNT 1
{
time_t buf;
struct tm *local_ptm;
+ struct tm result = {0, };
time(&buf);
buf = time(NULL);
- local_ptm = localtime(&buf);
+ local_ptm = localtime_r(&buf, &result);
- if(local_ptm)
+ if (local_ptm)
strftime(strtime, size, "%m/%d %H:%M:%S", local_ptm);
}
-void __netconfig_debug(const char *format, ...)
+void netconfig_log(const char *format, ...)
{
va_list ap;
int log_size = 0;
va_end(ap);
}
+
+void log_cleanup(void)
+{
+ if (log_file == NULL)
+ return;
+
+ fclose(log_file);
+ log_file = NULL;
+}