#undef SECURE_LOG_
#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
({ do { \
- __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+ __dlog_sec_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
} while (0); })
// ---------------------------------------------------------------------
#pragma GCC diagnostic error "-Wformat"
int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+/*
+ * The stuff in the rest of this file should not be used directly.
+ */
+/**
+ * @internal
+ * @brief Send log.
+ * @details Use SECURE_LOG(), SECURE_SLOG(), SECURE_RLOG() family
+ * not to use __dlog_sec_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_sec_print
+ * @code
+ #define LOG_TAG USR_TAG
+ #include<dlog-internal.h>
+ __dlog_sec_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly");
+ * @endcode
+ */
+int __dlog_sec_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+
/**
* @internal
* @brief Send log with va_list.
return ret;
}
+/**
+ * @brief Print log
+ * @details Print a log line
+ * @param[in] log_id The target buffer ID
+ * @param[in] prio Priority
+ * @param[in] tag tag
+ * @param[in] fmt Format (same as printf)
+ * @return Bytes written, or negative error
+ */
+int __dlog_sec_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ int ret = __dlog_vprint(log_id, prio, tag, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
{
return __write_to_log(LOG_ID_APPS, prio, tag, fmt, ap, false);