--- /dev/null
+#!/bin/sh
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+#--------------------------------------
+# sticker
+#--------------------------------------
+STICKER_DEBUG=$1/sticker
+STICKER_HOME=/opt/usr/home/owner/apps_rw/.shared/org.tizen.sticker-receiver/data/log
+STICKER_DB=/opt/dbspace/.sticker_info.db
+/bin/mkdir -p ${STICKER_DEBUG}
+/bin/cat ${STICKER_HOME}/sticker.log > ${STICKER_DEBUG}/sticker.log
+/bin/cp ${STICKER_DB}/.sticker_info.db* ${STICKER_DEBUG}/
+/bin/sync
+
+##UEP330x4988b0767795e32b117da2c8c810260b9f03a2808cd45af44f4584cde4d17be8149fd2921bdbcf4b0d6c08ef97453b983cb72e238c6c64b33e8286148e7b377f906f66407eec37edd6fd431d93a217109003fa0ebc99560a67954fe2910fe35a02523c131fd0ab36de45f140db756fdda71f58e1d9d46575d0c2f5453575aaa08d47e6f13a657420020353981fb8e5998b29c9af70272613dffd33a97502e51ea926a258c6de56cc21d951d28b1e44f1e33ed5a530c5dfb9a72714a56d30894f02bf98fb9cfd1521102abbf46f50d38dc079321850685808ae0fd05a22822592bec5a1883d7937d990cbd59947829ea7c2c0d43333a2f0d72d53c6bcef426bb7AAACAg==:UEP
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
+cp -af dump/sticker_log_dump.sh %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
+
mkdir -p %{buildroot}%{_prefix}/lib/systemd/system
install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/capi-ui-sticker.service
%{TZ_SYS_RO_SHARE}/parser-plugins/capi-ui-sticker.info
%{TZ_SYS_RO_ETC}/package-manager/parserlib/category/libcapi-ui-sticker-parser.so*
%{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libcapi-ui-sticker-parser.so*
+%{TZ_SYS_ETC}/dump.d/module.d/*
%files devel
%manifest %{name}-devel.manifest
src/ft.cpp
src/sticker_info.cpp
src/message.cpp
+ src/sticker_log.cpp
)
INCLUDE(FindPkgConfig)
#define __debug_H__
#include <dlog.h>
+#include <sys/types.h>
+#include <unistd.h>
#undef LOG_TAG
#define LOG_TAG "STICKER_RECEIVER"
-#ifndef _LOG
-#define _LOG(logLevel, fmt, ...) do { \
+void sticker_save_log (const char *fmt, ...);
+
+#define _STICKER_RECEIVER_LOG(logLevel, fmt, ...) do { \
dlog_print(logLevel, LOG_TAG, "%s : %s(%d) > " fmt, rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ sticker_save_log("pid(%d) %s : %s(%d) > " fmt, getpid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while (0)
-#endif
-#ifndef LOGD
-#define LOGD(format, arg...) _LOG(DLOG_DEBUG, format, ##arg)
-#endif
+#undef LOGD
+#define LOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg)
-#ifndef LOGI
-#define LOGI(format, arg...) _LOG(DLOG_INFO, format, ##arg)
-#endif
+#undef LOGI
+#define LOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg)
-#ifndef LOGW
-#define LOGW(format, arg...) _LOG(DLOG_WARN, format, ##arg)
-#endif
+#undef LOGW
+#define LOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg)
-#ifndef LOGE
-#define LOGE(format, arg...) _LOG(DLOG_ERROR, format, ##arg)
-#endif
+#undef LOGE
+#define LOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg)
-#ifndef LOGF
-#define LOGF(format, arg...) _LOG(DLOG_FATAL, format, ##arg)
-#endif
+#undef LOGF
+#define LOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg)
#endif /* __debug_H__ */
\ No newline at end of file
LOGD("");
+ char log_path[PATH_MAX];
+ char *data_path = NULL;
+ data_path = app_get_shared_data_path();
+ snprintf(log_path, sizeof(log_path), "%s/log", data_path);
+
+ if (data_path)
+ free(data_path);
+
+ if (access(log_path, F_OK) != 0) {
+ if (mkdir(log_path, 0755) == -1) {
+ LOGE("directory create error");
+ }
+ }
+
return true;
}
--- /dev/null
+#include <dlog.h>
+#include <stdio.h>
+#include <string>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <iostream>
+#include <fstream>
+#include <linux/limits.h>
+#include <time.h>
+#include <app_common.h>
+
+#include "log.h"
+
+using namespace std;
+
+void sticker_save_log(const char *fmt, ...)
+{
+ char buf[4000] = {0};
+ char time_buf[96] = {0};
+ char full_buf[4096] = {0};
+ char log_path[PATH_MAX];
+ char strLogFile[PATH_MAX];
+ va_list ap;
+
+ struct timespec ts;
+ clock_gettime(CLOCK_REALTIME, &ts);
+ const time_t tt = ts.tv_sec;
+ const long int real_millisec = ts.tv_nsec / 1000000;
+
+ struct tm *const ptm = localtime(&tt);
+ strftime(time_buf, sizeof(time_buf), "%m-%d %H:%M:%S", ptm);
+
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof (buf), fmt, ap);
+ va_end(ap);
+
+ snprintf(full_buf, sizeof(full_buf), "%s.%03ld %s", time_buf, real_millisec, buf);
+
+ char *data_path = NULL;
+ data_path = app_get_shared_data_path();
+ snprintf(log_path, sizeof(log_path), "%s/log", data_path);
+
+ if (data_path)
+ free(data_path);
+
+ snprintf(strLogFile, sizeof(strLogFile), "%s/sticker.log", log_path);
+
+ std::ofstream sticker_log_file (strLogFile, std::ios::app);
+ sticker_log_file << full_buf << std::endl;
+ sticker_log_file.flush ();
+}