return write_to_log(log_id, prio, tag, buf);
}
-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)
+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)
{
int ret = dlog_check_validity(log_id, prio, tag);
if (ret < 0)
* pointer could be made to point at a null handler instead of a true NULL)
* but giving this guarantee makes everything a lot simpler as it removes
* the risk of something suddenly becoming NULL during processing. */
- ret = !initialize() || !write_to_log
- ? DLOG_ERROR_NOT_PERMITTED
- : __write_to_log_critical_section(log_id, prio, tag, fmt, ap, check_should_log)
- ;
+ if (!initialize() || !write_to_log)
+ ret = DLOG_ERROR_NOT_PERMITTED;
+ else if (secure_log && !enable_secure_logs)
+ ret = 0;
+ else
+ ret = __write_to_log_critical_section(log_id, prio, tag, fmt, ap, check_should_log);
pthread_setcancelstate(old_cancel_state, NULL);
*/
int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap)
{
- int ret = __write_to_log(log_id, prio, tag, fmt, ap, true);
+ int ret = __write_to_log(log_id, prio, tag, fmt, ap, true, false);
__dlog_fatal_assert(prio);
return ret;
va_list ap;
va_start(ap, fmt);
- int ret = __dlog_vprint(log_id, prio, tag, fmt, ap);
+ int ret = __write_to_log(log_id, prio, tag, fmt, ap, true, true);
+ __dlog_fatal_assert(prio);
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);
+ return __write_to_log(LOG_ID_APPS, prio, tag, fmt, ap, false, false);
}
int dlog_print(log_priority prio, const char *tag, const char *fmt, ...)