summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2018-05-11 15:08:49 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2018-06-12 10:49:47 +0200
commit680a49e6aedbe1b24373ba3a90fe074c2fa7cb57 (patch)
treede4dcff7172bbc479aca4e42720349597bec4a6f
parent934fd225c38494cd4e4866379ed40ef9dc7f2b8f (diff)
downloadttsd-worker-task-680a49e6aedbe1b24373ba3a90fe074c2fa7cb57.tar.gz
ttsd-worker-task-680a49e6aedbe1b24373ba3a90fe074c2fa7cb57.tar.bz2
ttsd-worker-task-680a49e6aedbe1b24373ba3a90fe074c2fa7cb57.zip
Add logger
use dlog with TTS-TASK-WORKER tag. Change-Id: I48c55423f7887bcb17cc30fea6daab8d14cb4b47
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/log.h66
2 files changed, 67 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e65ad5b..ecbf1cf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,6 @@
INCLUDE(FindPkgConfig)
pkg_check_modules(APP_PKGS REQUIRED
+ dlog
)
FOREACH (flag ${APP_PKGS_CFLAGS})
diff --git a/src/log.h b/src/log.h
new file mode 100644
index 0000000..563a373
--- /dev/null
+++ b/src/log.h
@@ -0,0 +1,66 @@
+/*
+* Copyright 2018 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __LOG_H__
+#define __LOG_H__
+
+#include <dlog.h>
+
+/**
+ * @addtogroup Utils
+ * @{
+ */
+
+#ifdef LOG_TAG
+ #undef LOG_TAG
+#endif
+
+/** @brief app default dlog tag */
+#define LOG_TAG "TTS-TASK-WORKER"
+
+/** @brief macro for getting information about source file */
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#if !defined(DBG)
+/** Prints debug level information to dlog */
+#define DBG(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(WRN)
+/** Prints warning level information to dlog */
+#define WRN(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(ERR)
+/** Prints error level information to dlog */
+#define ERR(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(INF)
+/** Prints info level information to dlog */
+#define INF(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(FATAL)
+/** Prints fatal level information to dlog */
+#define FAT(fmt, arg...) dlog_print(DLOG_FATAL, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg);
+#endif
+
+/**
+ * @}
+ */
+
+#endif