Add logger 82/180282/6
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 11 May 2018 13:08:49 +0000 (15:08 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 12 Jun 2018 08:49:47 +0000 (10:49 +0200)
use dlog with TTS-TASK-WORKER tag.

Change-Id: I48c55423f7887bcb17cc30fea6daab8d14cb4b47

src/CMakeLists.txt
src/log.h [new file with mode: 0644]

index e65ad5b..ecbf1cf 100644 (file)
@@ -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 (file)
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