mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 01:47:58 +02:00
logging: add nm_logging_get_level() function
This commit is contained in:
parent
4c7fbcc941
commit
13101f8444
2 changed files with 23 additions and 0 deletions
|
|
@ -445,6 +445,27 @@ nm_logging_all_domains_to_string (void)
|
|||
return str->str;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_logging_get_level:
|
||||
* @domain: find the lowest enabled logging level for the
|
||||
* given domain. If this is a set of multiple
|
||||
* domains, the most verbose level will be returned.
|
||||
*
|
||||
* Returns: the lowest (most verbose) logging level for the
|
||||
* give @domain, or %_LOGL_OFF if it is disabled.
|
||||
**/
|
||||
NMLogLevel
|
||||
nm_logging_get_level (NMLogDomain domain)
|
||||
{
|
||||
NMLogLevel sl = _LOGL_OFF;
|
||||
|
||||
G_STATIC_ASSERT (LOGL_TRACE == 0);
|
||||
while ( sl > LOGL_TRACE
|
||||
&& nm_logging_enabled (sl - 1, domain))
|
||||
sl--;
|
||||
return sl;
|
||||
}
|
||||
|
||||
#if SYSTEMD_JOURNAL
|
||||
__attribute__((__format__ (__printf__, 4, 5)))
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ nm_logging_enabled (NMLogLevel level, NMLogDomain domain)
|
|||
&& !!(_nm_logging_enabled_state[level] & domain);
|
||||
}
|
||||
|
||||
NMLogLevel nm_logging_get_level (NMLogDomain domain);
|
||||
|
||||
const char *nm_logging_all_levels_to_string (void);
|
||||
const char *nm_logging_all_domains_to_string (void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue