summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-10-24 17:03:29 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-10-24 17:03:29 +0900
commit0521bbfeade0ec611aa4101cbfa1c242c51dc420 (patch)
tree49c0f3de97a530363ddc76d506fb3006e0657e1b
parent949280f9e145d767ec9f3861f5820b7ac1832be8 (diff)
downloaddlog-0521bbfeade0ec611aa4101cbfa1c242c51dc420.tar.gz
dlog-0521bbfeade0ec611aa4101cbfa1c242c51dc420.tar.bz2
dlog-0521bbfeade0ec611aa4101cbfa1c242c51dc420.zip
-rwxr-xr-xMakefile.am6
-rwxr-xr-xdoc/dlog_doc.h95
-rwxr-xr-xinclude/dlog-internal.h444
-rwxr-xr-xinclude/dlog.h408
-rwxr-xr-xinclude/logprint.h1
-rwxr-xr-xpackaging/dlog.spec11
-rw-r--r--packaging/dlog_logger.conf-debug.in (renamed from packaging/dlog_logger.conf-micro-debug.in)2
-rw-r--r--packaging/dlog_logger.conf.in6
-rw-r--r--packaging/dlog_logger.service4
-rw-r--r--packaging/dlogutil.manifest5
-rwxr-xr-xsrc/libdlog/log.c3
-rw-r--r--src/libdlog/loglimiter.c1
-rw-r--r--src/logger/logger.c2
-rwxr-xr-xsrc/logutil/logutil.c5
-rwxr-xr-xsrc/shared/logprint.c10
15 files changed, 582 insertions, 421 deletions
diff --git a/Makefile.am b/Makefile.am
index b0d79d5..3d3097d 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
AM_CFLAGS = -I$(srcdir)/include \
$(DEBUG_CFLAGS) \
-Werror \
@@ -5,13 +7,15 @@ AM_CFLAGS = -I$(srcdir)/include \
dlog_includedir = $(includedir)/dlog
dlog_include_HEADERS = \
- include/dlog.h
+ include/dlog.h \
+ include/dlog-internal.h
lib_LTLIBRARIES = libdlog.la
libdlog_la_SOURCES = \
src/libdlog/log.c \
include/dlog.h \
+ include/dlog-internal.h \
src/libdlog/logconfig.c \
include/logconfig.h \
src/libdlog/loglimiter.c \
diff --git a/doc/dlog_doc.h b/doc/dlog_doc.h
index 1d825b1..179b8a2 100755
--- a/doc/dlog_doc.h
+++ b/doc/dlog_doc.h
@@ -52,6 +52,101 @@ priority level indicates the urgency of log message
<td>Error message - Indicate error.</td>
</tr>
</table>
+
+<h2 class="pg">Marco example for useful usage</h2>
+The dlog APIs can be used by defining own macros. The macros can be defined like below examples.
+Thus, developers can use appropriate method as a matter of convenience.
+
+@code
+#undef LOG_TAG
+#define LOG_TAG "APP_TAG"
+
+#define LOGI(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#define LOGW(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#define LOGE(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+@endcode
+
+<h1 class="pg">dlogutil</h1>
+<h2 class="pg">Introduction</h2>
+You can use dlogutil command to view and follow the contents of the log buffers. The general usage is :
+@code
+dlogutil [<option>] ... [<filter-spec>] ...
+@endcode
+
+<h2 class="pg">Filtering log output</h2>
+Every log message has a <I>tag</I> and a <I>priority</I> associated with it.
+Filter expression follows this format <B><I>tag:priority</I></B> where <I>tag</I> indicates the tag of interest and <I>priority</I> indicates the minimum level of priority to report for that tag. You can add any number of tag:priority specifications in a single filter expression.
+The tag of a log message is a short indicating the system component from which the message originates
+The <I>priority</I> is one of the following character values, orderd from lowest to highest priority:<br>
+D - debug<br>
+I - info<br>
+W - warning<br>
+E - Error<br>
+
+for example, if you want to see MY_APP tag and above of debug priority,
+@code
+# dlogutil MY_APP:D
+@endcode
+if you want to see all log message above of info priority.
+@code
+# dlogutil *:I
+@endcode
+
+<h2 class="pg">List of logutil command options</h2>
+
+<table>
+<tr>
+ <th>Option</th>
+ <th>Description</th>
+</tr>
+<tr>
+ <td>-b \<buffer\> </td>
+ <td>Alternate log buffer. The main buffer is used by default buffer. </td>
+</tr>
+<tr>
+ <td>-c</td>
+ <td>Clears the entire log and exits</td>
+</tr>
+<tr>
+ <td>-d</td>
+ <td>Dumps the log and exits.</td>
+</tr>
+<tr>
+ <td>-f \<filename\></td>
+ <td>Writes log to filename. The default is stdout</td>
+</tr>
+<tr>
+ <td>-g</td>
+ <td>Print the size of the specified log buffer and exits.</td>
+</tr>
+<tr>
+ <td>-n \<count\></td>
+ <td>Sets the maximum number of rotated logs to count. The default value is 4. Requires the -r option</td>
+</tr>
+<tr>
+ <td>-r \<Kbytes\></td>
+ <td>Rotates the log file every Kbytes of output. The default value is 16. Requires the -f option.</td>
+</tr>
+<tr>
+ <td>-s</td>
+ <td>Sets the default filter spec to silent.</td>
+</tr>
+<tr>
+ <td>-v \<format\></td>
+ <td>Sets the output format for log messages. The default is brief format. </td>
+</tr>
+
+</table>
+>>>>>>> mobile
*
**/
#endif /* __TIZEN_SYSTEM_DLOG_DOC_H__ */
diff --git a/include/dlog-internal.h b/include/dlog-internal.h
new file mode 100755
index 0000000..a91e7a5
--- /dev/null
+++ b/include/dlog-internal.h
@@ -0,0 +1,444 @@
+/*
+ * DLOG
+ * Copyright (c) 2005-2008, The Android Open Source Project
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/**
+ * @file dlog-internal.h
+ * @version 0.4
+ * @brief This file is the header file of interface of dlog.
+ */
+#ifndef _DLOG_INTERNAL_H_
+#define _DLOG_INTERNAL_H_
+
+#include <tizen_error.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "dlog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * This is the local tag used for the following simplified
+ * logging macros. You can change this preprocessor definition
+ * before using the other macros to change the tag.
+ */
+#ifndef LOG_TAG
+#define LOG_TAG NULL
+#endif
+
+#ifndef __MODULE__
+#define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+#endif
+
+#ifdef TIZEN_ENGINEER_MODE
+#ifndef TIZEN_DEBUG_ENABLE
+#define TIZEN_DEBUG_ENABLE
+#endif
+#endif
+
+/**
+ * @internal
+ * @brief log id
+ * @since_tizen 2.3
+ */
+typedef enum {
+ LOG_ID_MAIN = 0,
+ LOG_ID_RADIO,
+ LOG_ID_SYSTEM,
+ LOG_ID_APPS,
+ LOG_ID_MAX
+} log_id_t;
+
+static inline int __dlog_no_print(const char *fmt __attribute__((unused)), ...) { return 0; }
+
+#define CONDITION(cond) (__builtin_expect((cond) != 0, 0))
+#define NOP(...) ({ do { __dlog_no_print(__VA_ARGS__); } while (0); })
+
+// Macro inner work---------------------------------------------------------------
+#undef LOG_
+#ifdef TIZEN_DEBUG_ENABLE
+#define LOG_(id, prio, tag, fmt, arg...) \
+ ({ do { \
+ __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#else
+#define LOG_(id, prio, tag, fmt, arg...) \
+ ({ do { \
+ if ((int)prio != DLOG_DEBUG) { \
+ __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } \
+ } while (0); })
+#endif
+
+#undef SECURE_LOG_
+#ifdef TIZEN_DEBUG_ENABLE
+#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
+ ({ do { \
+ __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#else
+#define SECURE_LOG_(id, prio, tag, fmt, arg...) NOP(fmt, ##arg)
+#endif
+// ---------------------------------------------------------------------
+/**
+ * @internal
+ * @brief For Secure Log.
+ * @remarks Normally we strip Secure log from release builds.
+ * Please use this macros.
+ */
+/**
+ * @internal
+ * @brief For Application and etc.
+ * @details Simplified macro to send a main log message using the current LOG_TAG.
+ * Example:
+ * SECURE_LOGD("app debug %d", num);
+ * SECURE_LOGE("app error %d", num);
+ */
+#define SECURE_LOGD(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#define SECURE_LOGI(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SECURE_LOGW(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SECURE_LOGE(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define SECURE_LOGF(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Framework and system etc.
+ * @details Simplified macro to send a system log message using the current LOG_TAG.
+ * Example:
+ * SECURE_SLOGD("system debug %d", num);
+ * SECURE_SLOGE("system error %d", num);
+ */
+#define SECURE_SLOGD(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#define SECURE_SLOGI(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SECURE_SLOGW(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SECURE_SLOGE(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define SECURE_SLOGF(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Modem and radio etc.
+ * @details Simplified macro to send a radio log message using the current LOG_TAG.
+ * Example:
+ * SECURE_RLOGD("radio debug %d", num);
+ * SECURE_RLOGE("radio error %d", num);
+ */
+#define SECURE_RLOGD(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#define SECURE_RLOGI(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SECURE_RLOGW(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SECURE_RLOGE(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define SECURE_RLOGF(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Tizen OSP Application macro.
+ */
+#define SECURE_ALOGD(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#define SECURE_ALOGI(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SECURE_ALOGW(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SECURE_ALOGE(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define SECURE_ALOGF(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @details If you want use redefined macro.
+ * You can use this macro.
+ * This macro need priority and tag arguments.
+ */
+#define SECURE_LOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
+#define SECURE_SLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
+#define SECURE_RLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
+#define SECURE_ALOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
+
+/**
+ * @internal
+ * @brief For Application and etc.
+ * @details Simplified macro to send a main log message using the current LOG_TAG.
+ * Example:
+ * LOGD("app debug %d", num);
+ * LOGE("app error %d", num);
+ */
+#ifdef TIZEN_DEBUG_ENABLE
+#define LOGD(format, arg...) LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#else
+#define LOGD(format, arg...) NOP(format, ##arg)
+#endif
+#define LOGI(format, arg...) LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
+#define LOGW(format, arg...) LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
+#define LOGE(format, arg...) LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define LOGF(format, arg...) LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Framework and system etc.
+ * @details Simplified macro to send a system log message using the current LOG_TAG.
+ * Example:
+ * SLOGD("system debug %d", num);
+ * SLOGE("system error %d", num);
+ */
+#ifdef TIZEN_DEBUG_ENABLE
+#define SLOGD(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#else
+#define SLOGD(format, arg...) NOP(format, ##arg)
+#endif
+#define SLOGI(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SLOGW(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SLOGE(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define SLOGF(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Modem and radio etc.
+ * @details Simplified macro to send a radio log message using the current LOG_TAG.
+ * Example:
+ * RLOGD("radio debug %d", num);
+ * RLOGE("radio error %d", num);
+ */
+#ifdef TIZEN_DEBUG_ENABLE
+#define RLOGD(format, arg...) LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#else
+#define RLOGD(format, arg...) NOP(format, ##arg)
+#endif
+#define RLOGI(format, arg...) LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
+#define RLOGW(format, arg...) LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
+#define RLOGE(format, arg...) LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define RLOGF(format, arg...) LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
+/**
+ * @internal
+ * @brief For Tizen OSP Application macro.
+ */
+#ifdef TIZEN_DEBUG_ENABLE
+#define ALOGD(format, arg...) LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#else
+#define ALOGD(format, arg...) NOP(format, ##arg)
+#endif
+#define ALOGI(format, arg...) LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
+#define ALOGW(format, arg...) LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
+#define ALOGE(format, arg...) LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
+#define ALOGF(format, arg...) LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
+
+/**
+ * @internal
+ * @brief Basic log message macro
+ * @details This macro allows you to specify a priority and a tag
+ * if you want to use this macro directly, you must add this messages for unity of messages.
+ * (LOG(prio, tag, "%s: %s(%d) > " format, __MODULE__, __func__, __LINE__, ##arg))
+ *
+ * Example:
+ * #define MYMACRO(prio, tag, format, arg...) \
+ * LOG(prio, tag, format, ##arg)
+ *
+ * MYMACRO(LOG_DEBUG, MYTAG, "test mymacro %d", num);
+ *
+ */
+#ifndef LOG
+#define LOG(priority, tag, format, arg...) LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
+#endif
+#define SLOG(priority, tag, format, arg...) LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
+#define RLOG(priority, tag, format, arg...) LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
+#define ALOG(priority, tag, format, arg...) LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
+/**
+ * @internal
+ */
+#define LOG_VA(priority, tag, fmt, args) \
+ vprint_log(D##priority, tag, fmt, args)
+#define ALOG_VA(priority, tag, fmt, args) \
+ vprint_apps_log(D##priority, tag, fmt, args)
+#define RLOG_VA(priority, tag, fmt, args) \
+ vprint_radio_log(D##priority, tag, fmt, args)
+#define SLOG_VA(priority, tag, fmt, args) \
+ vprint_system_log(D##priority, tag, fmt, args)
+#define print_apps_log(prio, tag, fmt...) \
+ __dlog_print(LOG_ID_APPS, prio, tag, fmt)
+#define vprint_apps_log(prio, tag, fmt...) \
+ __dlog_vprint(LOG_ID_APPS, prio, tag, fmt)
+#define print_log(prio, tag, fmt...) \
+ __dlog_print(LOG_ID_MAIN, prio, tag, fmt)
+#define vprint_log(prio, tag, fmt...) \
+ __dlog_vprint(LOG_ID_MAIN, prio, tag, fmt)
+#define print_radio_log(prio, tag, fmt...)\
+ __dlog_print(LOG_ID_RADIO, prio, tag, fmt)
+#define vprint_radio_log(prio, tag, fmt...) \
+ __dlog_vprint(LOG_ID_RADIO, prio, tag, fmt)
+#define print_system_log(prio, tag, fmt...)\
+ __dlog_print(LOG_ID_SYSTEM, prio, tag, fmt)
+#define vprint_system_log(prio, tag, fmt...) \
+ __dlog_vprint(LOG_ID_SYSTEM, prio, tag, fmt)
+
+// ---------------------------------------------------------------------
+// Don't use below macro no more!! It will be removed -- Verbose and Fatal priority macro will be removed --
+#define COMPATIBILITY_ON
+#ifdef COMPATIBILITY_ON
+/**
+ * @internal
+ * @breif Conditional Macro.
+ * @remarks Don't use this macro. It's just compatibility.
+ * It will be deprecated.
+ */
+#define LOGD_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ LOGD(format, ##arg); \
+ } \
+ } while (0); })
+#define LOGI_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ LOGI(format, ##arg); \
+ } \
+ } while (0); })
+#define LOGW_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ LOGW(format, ##arg); \
+ } \
+ } while (0); })
+#define LOGE_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ LOGE(format, ##arg); \
+ } \
+ } while (0); })
+#define LOGF_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ LOGF(format, ##arg); \
+ } \
+ } while (0); })
+#define SLOGD_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ SLOGD(format, ##arg); \
+ } \
+ } while (0); })
+#define SLOGI_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ SLOGI(format, ##arg); \
+ } \
+ } while (0); })
+#define SLOGW_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ SLOGW(format, ##arg); \
+ } \
+ } while (0); })
+#define SLOGE_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ SLOGE(format, ##arg); \
+ } \
+ } while (0); })
+#define SLOGF_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ SLOGF(format, ##arg); \
+ } \
+ } while (0); })
+#define RLOGD_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ RLOGD(format, ##arg); \
+ } \
+ } while (0); })
+#define RLOGI_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ RLOGI(format, ##arg); \
+ } \
+ } while (0); })
+#define RLOGW_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ RLOGW(format, ##arg); \
+ } \
+ } while (0); })
+#define RLOGE_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ RLOGE(format, ##arg); \
+ } \
+ } while (0); })
+#define RLOGF_IF(cond, format, arg...) \
+ ({ do { \
+ if (CONDITION(cond)) { \
+ RLOGF(format, ##arg); \
+ } \
+ } while (0); })
+#define LOG_ON() ({ do { } while (0); })
+#define LOGV(format, arg...) NOP(format, ##arg)
+#define SLOGV(format, arg...) NOP(format, ##arg)
+#define RLOGV(format, arg...) NOP(format, ##arg)
+#define ALOGV(format, arg...) NOP(format, ##arg)
+#define LOGV_IF(cond, format, arg...) NOP(format, ##arg)
+#define SLOGV_IF(cond, format, arg...) NOP(format, ##arg)
+#define RLOGV_IF(cond, format, arg...) NOP(format, ##arg)
+#define SECLOG(...) ({ do { } while (0); })
+#endif
+// ---------------------------------------------------------------------
+
+/*
+ * The stuff in the rest of this file should not be used directly.
+ */
+/**
+ * @internal
+ * @brief Send log.
+ * @details Use LOG(), SLOG(), RLOG() family
+ * not to use __dlog_print() directly
+ * @remarks Must not use this API directly. use macros instead.
+ * @param[in] log_id log device id
+ * @param[in] prio priority
+ * @param[in] tag tag
+ * @param[in] fmt format string
+ * @return Operation result
+ * @retval 0>= Success
+ * @retval -1 Error
+ * @pre none
+ * @post none
+ * @see __dlog_print
+ * @code
+ #define LOG_TAG USR_TAG
+ #include<dlog-internal.h>
+ __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly");
+ * @endcode
+ */
+int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...);
+
+/**
+ * @internal
+ * @brief Send log with va_list.
+ * @details Use LOG_VA(), SLOG_VA(), RLOG_VA() family
+ not to use __dlog_vprint() directly
+ * @remarks Must not use this API directly. use macros instead.
+ * @param[in] log_id log device id
+ * @param[in] prio priority
+ * @param[in] tag tag
+ * @param[in] fmt format string
+ * @param[in] ap va_list
+ * @return Operation result
+ * @retval 0>= Success
+ * @retval -1 Error
+ * @pre none
+ * @post none
+ * @see __dlog_vprint
+ * @code
+ #define LOG_TAG USR_TAG
+ #include<dlog-internal.h>
+ __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap);
+ * @endcode
+ */
+int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _DLOG_INTERNAL_H_*/
diff --git a/include/dlog.h b/include/dlog.h
index 1a61715..9fd134a 100755
--- a/include/dlog.h
+++ b/include/dlog.h
@@ -28,6 +28,8 @@
#include <stdarg.h>
#include <string.h>
+#include "dlog-internal.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -41,16 +43,6 @@ extern "C" {
#define LOG_TAG NULL
#endif
-#ifndef __MODULE__
-#define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-#endif
-
-#ifdef TIZEN_ENGINEER_MODE
-#ifndef TIZEN_DEBUG_ENABLE
-#define TIZEN_DEBUG_ENABLE
-#endif
-#endif
-
/**
* @addtogroup CAPI_SYSTEM_DLOG
* @{
@@ -58,12 +50,12 @@ extern "C" {
*/
/**
* @brief Enumeration for Dlog Error.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @since_tizen 2.3
*/
typedef enum {
DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
+ DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED /**< Operation not permitted */
} dlog_error_e;
/**
* @}
@@ -76,7 +68,7 @@ typedef enum {
*/
/**
* @brief log priority values, in ascending priority order.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @since_tizen 2.3
*/
typedef enum {
DLOG_UNKNOWN = 0, /**< Keep this always at the start */
@@ -95,347 +87,13 @@ typedef enum {
*/
/**
- * @internal
- * @brief log id
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- LOG_ID_MAIN = 0,
- LOG_ID_RADIO,
- LOG_ID_SYSTEM,
- LOG_ID_APPS,
- LOG_ID_MAX
-} log_id_t;
-
-static inline int __dlog_no_print(const char *fmt __attribute__((unused)), ...) { return 0; }
-
-#define CONDITION(cond) (__builtin_expect((cond) != 0, 0))
-#define NOP(...) ({ do { __dlog_no_print(__VA_ARGS__); } while (0); })
-
-// Macro inner work---------------------------------------------------------------
-#undef LOG_
-#ifdef TIZEN_DEBUG_ENABLE
-#define LOG_(id, prio, tag, fmt, arg...) \
- ({ do { \
- __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
- } while (0); })
-#else
-#define LOG_(id, prio, tag, fmt, arg...) \
- ({ do { \
- if ((int)prio != DLOG_DEBUG) { \
- __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
- } \
- } while (0); })
-#endif
-
-#undef SECURE_LOG_
-#ifdef TIZEN_DEBUG_ENABLE
-#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
- ({ do { \
- __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
- } while (0); })
-#else
-#define SECURE_LOG_(id, prio, tag, fmt, arg...) NOP(fmt, ##arg)
-#endif
-// ---------------------------------------------------------------------
-/**
- * @internal
- * @brief For Secure Log.
- * @remarks Normally we strip Secure log from release builds.
- * Please use this macros.
- */
-/**
- * @internal
- * @brief For Application and etc.
- * @details Simplified macro to send a main log message using the current LOG_TAG.
- * Example:
- * SECURE_LOGD("app debug %d", num);
- * SECURE_LOGE("app error %d", num);
- */
-#define SECURE_LOGD(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#define SECURE_LOGI(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
-#define SECURE_LOGW(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
-#define SECURE_LOGE(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define SECURE_LOGF(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Framework and system etc.
- * @details Simplified macro to send a system log message using the current LOG_TAG.
- * Example:
- * SECURE_SLOGD("system debug %d", num);
- * SECURE_SLOGE("system error %d", num);
- */
-#define SECURE_SLOGD(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#define SECURE_SLOGI(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
-#define SECURE_SLOGW(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
-#define SECURE_SLOGE(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define SECURE_SLOGF(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Modem and radio etc.
- * @details Simplified macro to send a radio log message using the current LOG_TAG.
- * Example:
- * SECURE_RLOGD("radio debug %d", num);
- * SECURE_RLOGE("radio error %d", num);
- */
-#define SECURE_RLOGD(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#define SECURE_RLOGI(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
-#define SECURE_RLOGW(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
-#define SECURE_RLOGE(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define SECURE_RLOGF(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Tizen OSP Application macro.
- */
-#define SECURE_ALOGD(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#define SECURE_ALOGI(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
-#define SECURE_ALOGW(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
-#define SECURE_ALOGE(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define SECURE_ALOGF(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @details If you want use redefined macro.
- * You can use this macro.
- * This macro need priority and tag arguments.
- */
-#define SECURE_LOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
-#define SECURE_SLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
-#define SECURE_RLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
-#define SECURE_ALOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
-
-/**
- * @internal
- * @brief For Application and etc.
- * @details Simplified macro to send a main log message using the current LOG_TAG.
- * Example:
- * LOGD("app debug %d", num);
- * LOGE("app error %d", num);
- */
-#ifdef TIZEN_DEBUG_ENABLE
-#define LOGD(format, arg...) LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#else
-#define LOGD(format, arg...) NOP(format, ##arg)
-#endif
-#define LOGI(format, arg...) LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
-#define LOGW(format, arg...) LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
-#define LOGE(format, arg...) LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define LOGF(format, arg...) LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Framework and system etc.
- * @details Simplified macro to send a system log message using the current LOG_TAG.
- * Example:
- * SLOGD("system debug %d", num);
- * SLOGE("system error %d", num);
- */
-#ifdef TIZEN_DEBUG_ENABLE
-#define SLOGD(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#else
-#define SLOGD(format, arg...) NOP(format, ##arg)
-#endif
-#define SLOGI(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
-#define SLOGW(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
-#define SLOGE(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define SLOGF(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Modem and radio etc.
- * @details Simplified macro to send a radio log message using the current LOG_TAG.
- * Example:
- * RLOGD("radio debug %d", num);
- * RLOGE("radio error %d", num);
- */
-#ifdef TIZEN_DEBUG_ENABLE
-#define RLOGD(format, arg...) LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#else
-#define RLOGD(format, arg...) NOP(format, ##arg)
-#endif
-#define RLOGI(format, arg...) LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
-#define RLOGW(format, arg...) LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
-#define RLOGE(format, arg...) LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define RLOGF(format, arg...) LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
-/**
- * @internal
- * @brief For Tizen OSP Application macro.
- */
-#ifdef TIZEN_DEBUG_ENABLE
-#define ALOGD(format, arg...) LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
-#else
-#define ALOGD(format, arg...) NOP(format, ##arg)
-#endif
-#define ALOGI(format, arg...) LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
-#define ALOGW(format, arg...) LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
-#define ALOGE(format, arg...) LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
-#define ALOGF(format, arg...) LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
-
-/**
- * @internal
- * @brief Basic log message macro
- * @details This macro allows you to specify a priority and a tag
- * if you want to use this macro directly, you must add this messages for unity of messages.
- * (LOG(prio, tag, "%s: %s(%d) > " format, __MODULE__, __func__, __LINE__, ##arg))
- *
- * Example:
- * #define MYMACRO(prio, tag, format, arg...) \
- * LOG(prio, tag, format, ##arg)
- *
- * MYMACRO(LOG_DEBUG, MYTAG, "test mymacro %d", num);
- *
- */
-#ifndef LOG
-#define LOG(priority, tag, format, arg...) LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
-#endif
-#define SLOG(priority, tag, format, arg...) LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
-#define RLOG(priority, tag, format, arg...) LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
-#define ALOG(priority, tag, format, arg...) LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
-/**
- * @internal
- */
-#define LOG_VA(priority, tag, fmt, args) \
- vprint_log(D##priority, tag, fmt, args)
-#define ALOG_VA(priority, tag, fmt, args) \
- vprint_apps_log(D##priority, tag, fmt, args)
-#define RLOG_VA(priority, tag, fmt, args) \
- vprint_radio_log(D##priority, tag, fmt, args)
-#define SLOG_VA(priority, tag, fmt, args) \
- vprint_system_log(D##priority, tag, fmt, args)
-#define print_apps_log(prio, tag, fmt...) \
- __dlog_print(LOG_ID_APPS, prio, tag, fmt)
-#define vprint_apps_log(prio, tag, fmt...) \
- __dlog_vprint(LOG_ID_APPS, prio, tag, fmt)
-#define print_log(prio, tag, fmt...) \
- __dlog_print(LOG_ID_MAIN, prio, tag, fmt)
-#define vprint_log(prio, tag, fmt...) \
- __dlog_vprint(LOG_ID_MAIN, prio, tag, fmt)
-#define print_radio_log(prio, tag, fmt...)\
- __dlog_print(LOG_ID_RADIO, prio, tag, fmt)
-#define vprint_radio_log(prio, tag, fmt...) \
- __dlog_vprint(LOG_ID_RADIO, prio, tag, fmt)
-#define print_system_log(prio, tag, fmt...)\
- __dlog_print(LOG_ID_SYSTEM, prio, tag, fmt)
-#define vprint_system_log(prio, tag, fmt...) \
- __dlog_vprint(LOG_ID_SYSTEM, prio, tag, fmt)
-
-// ---------------------------------------------------------------------
-// Don't use below macro no more!! It will be removed -- Verbose and Fatal priority macro will be removed --
-#define COMPATIBILITY_ON
-#ifdef COMPATIBILITY_ON
-/**
- * @internal
- * @breif Conditional Macro.
- * @remarks Don't use this macro. It's just compatibility.
- * It will be deprecated.
- */
-#define LOGD_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- LOGD(format, ##arg); \
- } \
- } while (0); })
-#define LOGI_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- LOGI(format, ##arg); \
- } \
- } while (0); })
-#define LOGW_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- LOGW(format, ##arg); \
- } \
- } while (0); })
-#define LOGE_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- LOGE(format, ##arg); \
- } \
- } while (0); })
-#define LOGF_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- LOGF(format, ##arg); \
- } \
- } while (0); })
-#define SLOGD_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- SLOGD(format, ##arg); \
- } \
- } while (0); })
-#define SLOGI_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- SLOGI(format, ##arg); \
- } \
- } while (0); })
-#define SLOGW_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- SLOGW(format, ##arg); \
- } \
- } while (0); })
-#define SLOGE_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- SLOGE(format, ##arg); \
- } \
- } while (0); })
-#define SLOGF_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- SLOGF(format, ##arg); \
- } \
- } while (0); })
-#define RLOGD_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- RLOGD(format, ##arg); \
- } \
- } while (0); })
-#define RLOGI_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- RLOGI(format, ##arg); \
- } \
- } while (0); })
-#define RLOGW_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- RLOGW(format, ##arg); \
- } \
- } while (0); })
-#define RLOGE_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- RLOGE(format, ##arg); \
- } \
- } while (0); })
-#define RLOGF_IF(cond, format, arg...) \
- ({ do { \
- if (CONDITION(cond)) { \
- RLOGF(format, ##arg); \
- } \
- } while (0); })
-#define LOG_ON() ({ do { } while (0); })
-#define LOGV(format, arg...) NOP(format, ##arg)
-#define SLOGV(format, arg...) NOP(format, ##arg)
-#define RLOGV(format, arg...) NOP(format, ##arg)
-#define ALOGV(format, arg...) NOP(format, ##arg)
-#define LOGV_IF(cond, format, arg...) NOP(format, ##arg)
-#define SLOGV_IF(cond, format, arg...) NOP(format, ##arg)
-#define RLOGV_IF(cond, format, arg...) NOP(format, ##arg)
-#define SECLOG(...) ({ do { } while (0); })
-#endif
-// ---------------------------------------------------------------------
-
-/**
* @addtogroup CAPI_SYSTEM_DLOG
* @{
*/
/**
* @brief Send log with priority and tag.
* @details for application
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @since_tizen 2.3
* @param[in] prio log_priority
* @param[in] tag tag
* @param[in] fmt format string
@@ -464,7 +122,7 @@ int dlog_print(log_priority prio, const char *tag, const char *fmt, ...);
/**
* @brief Send log with priority, tag and va_list.
* @details for application
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @since_tizen 2.3
* @param[in] prio log_priority
* @param[in] tag tag
* @param[in] fmt format string
@@ -500,58 +158,6 @@ int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
* @}
*/
-
-/*
- * The stuff in the rest of this file should not be used directly.
- */
-/**
- * @internal
- * @brief Send log.
- * @details Use LOG(), SLOG(), RLOG() family
- * not to use __dlog_print() directly
- * @remarks Must not use this API directly. use macros instead.
- * @param[in] log_id log device id
- * @param[in] prio priority
- * @param[in] tag tag
- * @param[in] fmt format string
- * @return Operation result
- * @retval 0>= Success
- * @retval -1 Error
- * @pre none
- * @post none
- * @see __dlog_print
- * @code
- #define LOG_TAG USR_TAG
- #include<dlog.h>
- __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly");
- * @endcode
- */
-int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...);
-
-/**
- * @internal
- * @brief Send log with va_list.
- * @details Use LOG_VA(), SLOG_VA(), RLOG_VA() family
- not to use __dlog_vprint() directly
- * @remarks Must not use this API directly. use macros instead.
- * @param[in] log_id log device id
- * @param[in] prio priority
- * @param[in] tag tag
- * @param[in] fmt format string
- * @param[in] ap va_list
- * @return Operation result
- * @retval 0>= Success
- * @retval -1 Error
- * @pre none
- * @post none
- * @see __dlog_vprint
- * @code
- #define LOG_TAG USR_TAG
- #include<dlog.h>
- __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap);
- * @endcode
- */
-int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap);
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/include/logprint.h b/include/logprint.h
index 45792f4..58bb333 100755
--- a/include/logprint.h
+++ b/include/logprint.h
@@ -23,6 +23,7 @@
#include <pthread.h>
#include <logger.h>
+#include <dlog-internal.h>
#include <dlog.h>
#ifdef __cplusplus
diff --git a/packaging/dlog.spec b/packaging/dlog.spec
index 5eda452..97d1f9e 100755
--- a/packaging/dlog.spec
+++ b/packaging/dlog.spec
@@ -10,7 +10,7 @@ Source102: packaging/libdlog.manifest
Source201: packaging/dlog.conf.in
Source202: packaging/dlog_logger.conf.in
Source203: packaging/dlog_logger.conf-micro.in
-Source204: packaging/dlog_logger.conf-micro-debug.in
+Source204: packaging/dlog_logger.conf-debug.in
Source301: packaging/dlog_logger.service
Source302: packaging/dlog_logger.path
BuildRequires: autoconf
@@ -60,16 +60,10 @@ Utilities for print log data
cp %{SOURCE101} .
cp %{SOURCE102} .
%autogen --disable-static
-%configure --disable-static \
-%if 0%{?tizen_build_binary_release_type_daily}
+%configure --disable-static \
--enable-fatal_on \
-%endif
-%if 0%{?tizen_build_binary_release_type_eng}
--enable-engineer_mode \
-%endif
-%if 0%{?sec_build_binary_debug_enable}
--enable-debug_enable \
-%endif
--without-systemd-journal
make %{?jobs:-j%jobs}
@@ -134,6 +128,7 @@ systemctl daemon-reload
%files -n libdlog-devel
%{_includedir}/dlog/dlog.h
+%{_includedir}/dlog/dlog-internal.h
%{_libdir}/pkgconfig/dlog.pc
%{_libdir}/libdlog.so
diff --git a/packaging/dlog_logger.conf-micro-debug.in b/packaging/dlog_logger.conf-debug.in
index a9c892f..7fbfa33 100644
--- a/packaging/dlog_logger.conf-micro-debug.in
+++ b/packaging/dlog_logger.conf-debug.in
@@ -1,3 +1,3 @@
dlogutil -b system -r 5120 -n 1 -f /var/log/dlog_system -v dump *:I
dlogutil -b main -r 3072 -n 1 -f /var/log/dlog_main -v dump *:W
-dlogutil -b radio -r 2048 -n 4 -f /var/log/dlog_radio -v dump
+dlogutil -b radio -r 2048 -n 3 -f /var/log/dlog_radio -v dump
diff --git a/packaging/dlog_logger.conf.in b/packaging/dlog_logger.conf.in
index 5445824..d8c301d 100644
--- a/packaging/dlog_logger.conf.in
+++ b/packaging/dlog_logger.conf.in
@@ -1,3 +1,3 @@
-dlogutil -b system -r 512 -n 1 -f /var/log/dlog_system -v dump *:I
-dlogutil -b main -r 256 -n 1 -f /var/log/dlog_main -v dump *:W
-dlogutil -b radio -r 512 -n 1 -f /var/log/dlog_radio -v dump
+dlogutil -b system -r 5120 -n 1 -f /var/log/dlog_system -v dump *:I
+dlogutil -b main -r 3072 -n 1 -f /var/log/dlog_main -v dump *:W
+dlogutil -b radio -r 1024 -n 1 -f /var/log/dlog_radio -v dump
diff --git a/packaging/dlog_logger.service b/packaging/dlog_logger.service
index 7ee6f1d..9b165ee 100644
--- a/packaging/dlog_logger.service
+++ b/packaging/dlog_logger.service
@@ -2,6 +2,10 @@
Description=Dumps dlog logs onto disk
[Service]
+Nice=19
+User=log
+Group=log
+SmackProcessLabel=dlogutil
ExecStart=/usr/bin/dlog_logger -b 99 -t 600
Restart=always
diff --git a/packaging/dlogutil.manifest b/packaging/dlogutil.manifest
index fc0a1bf..eb0a07b 100644
--- a/packaging/dlogutil.manifest
+++ b/packaging/dlogutil.manifest
@@ -1,6 +1,11 @@
<manifest>
<define>
<domain name="dlogutil"/>
+ <request>
+ <smack request="device::app_logging" type="r"/>
+ <smack request="device::sys_logging" type="r"/>
+ <smack request="system::sys_logging" type="rwx"/>
+ </request>
</define>
<assign>
<filesystem path="/usr/bin/dlog_logger" label="_" exec_label="none"/>
diff --git a/src/libdlog/log.c b/src/libdlog/log.c
index 46fa2d1..7ac948b 100755
--- a/src/libdlog/log.c
+++ b/src/libdlog/log.c
@@ -27,7 +27,10 @@
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
+
+#include <dlog-internal.h>
#include <dlog.h>
+
#include "loglimiter.h"
#include "logconfig.h"
#ifdef HAVE_SYSTEMD_JOURNAL
diff --git a/src/libdlog/loglimiter.c b/src/libdlog/loglimiter.c
index a0e874e..644c7ac 100644
--- a/src/libdlog/loglimiter.c
+++ b/src/libdlog/loglimiter.c
@@ -31,6 +31,7 @@
#include <time.h>
/* Included for priorities level */
+#include <dlog-internal.h>
#include <dlog.h>
#include "loglimiter.h"
diff --git a/src/logger/logger.c b/src/logger/logger.c
index 6b3a5cf..249dc60 100644
--- a/src/logger/logger.c
+++ b/src/logger/logger.c
@@ -45,7 +45,7 @@
#define COMMAND_MAX 5
#define DELIMITER " "
-#define FILE_PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
+#define FILE_PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)
#define MAX_ARGS 16
#define MAX_ROTATED 4
#define MAX_QUEUED 4096
diff --git a/src/logutil/logutil.c b/src/logutil/logutil.c
index ea96cfb..2fcd8ff 100755
--- a/src/logutil/logutil.c
+++ b/src/logutil/logutil.c
@@ -286,7 +286,6 @@ static void read_log_lines(struct log_device_t* devices)
exit(EXIT_FAILURE);
}
-
entry->entry.msg[entry->entry.len] = '\0';
enqueue(dev, entry);
@@ -737,7 +736,7 @@ int main(int argc, char **argv)
}
}
- if (getLogSize) {
+ if (getLogSize || g_nonblock) {
int size, readable;
size = get_log_size(dev->fd);
@@ -751,7 +750,7 @@ int main(int argc, char **argv)
perror("ioctl");
exit(EXIT_FAILURE);
}
-
+ g_log_rotate_size_kbytes += size / 1024;
printf("%s: ring buffer is %dKb (%dKb consumed), "
"max entry is %db, max payload is %db\n", dev->device,
size / 1024, readable / 1024,
diff --git a/src/shared/logprint.c b/src/shared/logprint.c
index 6ab4d72..e58a661 100755
--- a/src/shared/logprint.c
+++ b/src/shared/logprint.c
@@ -287,14 +287,18 @@ int log_add_filter_rule(log_format *p_format,
pri = DLOG_VERBOSE;
}
- char *tagName;
+ char *tagName = NULL;
tagName = strndup(filterExpression, tagNameLength);
+ if (!tagName) {
+ goto error;
+ }
FilterInfo *p_fi = filterinfo_new(tagName, pri);
free(tagName);
- if (!p_fi)
- goto error;
+ if (!p_fi) {
+ goto error;
+ }
p_fi->p_next = p_format->filters;
p_format->filters = p_fi;
}