From: Zbigniew Jędrzejewski-Szmek Date: Fri, 11 Dec 2020 06:41:04 +0000 (+0100) Subject: basic/log: add debug-level log_oom() variant X-Git-Tag: v248-rc1~511^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3a791580556c7e6f0c9d8ac836408e1c16627b9;p=thirdparty%2Fsystemd.git basic/log: add debug-level log_oom() variant This is useful for contexts where only debug-level messages are allowed. --- diff --git a/src/basic/log.c b/src/basic/log.c index dd9c7db18ba..7f2847da3cd 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -885,9 +885,8 @@ void log_assert_failed_return_realm( "Assertion '%s' failed at %s:%u, function %s(). Ignoring."); } -int log_oom_internal(LogRealm realm, const char *file, int line, const char *func) { - return log_internal_realm(LOG_REALM_PLUS_LEVEL(realm, LOG_ERR), - ENOMEM, file, line, func, "Out of memory."); +int log_oom_internal(int level, const char *file, int line, const char *func) { + return log_internal_realm(level, ENOMEM, file, line, func, "Out of memory."); } int log_format_iovec( diff --git a/src/basic/log.h b/src/basic/log.h index 6c5e42a0e43..41d828fd98d 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -168,7 +168,7 @@ int log_struct_internal( const char *format, ...) _printf_(6,0) _sentinel_; int log_oom_internal( - LogRealm realm, + int level, const char *file, int line, const char *func); @@ -286,7 +286,8 @@ int log_emergency_level(void); log_dump_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \ 0, PROJECT_FILE, __LINE__, __func__, buffer) -#define log_oom() log_oom_internal(LOG_REALM, PROJECT_FILE, __LINE__, __func__) +#define log_oom() log_oom_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, LOG_ERR), PROJECT_FILE, __LINE__, __func__) +#define log_oom_debug() log_oom_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, LOG_DEBUG), PROJECT_FILE, __LINE__, __func__) bool log_on_console(void) _pure_;