* @brief Check log validity
* @details Checks whether the log is valid and eligible for printing
* @param[in] log_id The target buffer ID
- * @param[in] prio The log's priority
- * @param[in] tag The log's tag
* @param[in] only_core Whether non-core buffers are rejected
* @return DLOG_ERROR_NONE on success, else an error code.
* @retval DLOG_ERROR_INVALID_PARAMETER Invalid parameter
*/
-static int dlog_check_validity(log_id_t log_id, int prio, const char *tag, bool only_core)
+static int dlog_check_validity(log_id_t log_id, bool only_core)
{
- (void) prio;
- if (!tag)
- return DLOG_ERROR_INVALID_PARAMETER;
-
if (!is_buffer_valid(log_id))
return DLOG_ERROR_INVALID_PARAMETER;
static int __write_to_log(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap, bool check_should_log, bool secure_log)
{
+ if (!fmt || !tag)
+ return DLOG_ERROR_INVALID_PARAMETER;
+
/* Write down the log first, before all other checks. This
* is because validity checks may involve syscalls, which
* could overwrite `errno` and ruin the `%m` specifier if
else if (len >= sizeof buf)
len = sizeof buf - 1;
-
- int ret = dlog_check_validity(log_id, prio, tag, check_should_log);
+ int ret = dlog_check_validity(log_id, check_should_log);
if (ret < 0)
return ret;
assert(__dlog_print((log_id_t) -1, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_INVALID_PARAMETER);
assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, NULL , "msg") == DLOG_ERROR_INVALID_PARAMETER);
+ assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, "tag", NULL) == DLOG_ERROR_INVALID_PARAMETER);
assert(__dlog_sec_print((log_id_t) -1, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_INVALID_PARAMETER);
assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_ERROR, NULL , "msg") == DLOG_ERROR_INVALID_PARAMETER);
+ assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_ERROR, "tag", NULL) == DLOG_ERROR_INVALID_PARAMETER);
limiter_ret = (struct pass_log_result) { .decision = DECISION_ALLOWED };
__dlog_fini();