Files
NetworkManager/shared/nm-glib-aux/nm-logging-base.h
Thomas Haller 40012e2aa8 shared: move log level info from core to "nm-logging-base.h"
We have our NM specific logging and log levels. Maybe we should
not have that, and instead only rely on syslog (like systemd)
or glog(). Anyway, currently we have one way and it makes sense
that this is also used outside from "src".

Move the helper function to parse log levels from string to
"nm-logging-base.h" so that we can use the same logging levels
outside of core.

This moves code that is currently GPL2+ licensed to
LGPL2.1+. However as far as I see, this code was entirely written
by Red Hat employees who would not object with this change. Also,
it's as obvious and trivial as it gets.
2019-11-28 19:20:33 +01:00

30 lines
861 B
C

// SPDX-License-Identifier: LGPL-2.1+
#ifndef __NM_LOGGING_BASE_H__
#define __NM_LOGGING_BASE_H__
#include "nm-logging-fwd.h"
typedef struct {
const char *name;
const char *level_str;
/* nm-logging uses syslog internally. Note that the three most-verbose syslog levels
* are LOG_DEBUG, LOG_INFO and LOG_NOTICE. Journal already highlights LOG_NOTICE
* as special.
*
* On the other hand, we have three levels LOGL_TRACE, LOGL_DEBUG and LOGL_INFO,
* which are regular messages not to be highlighted. For that reason, we must map
* LOGL_TRACE and LOGL_DEBUG both to syslog level LOG_DEBUG. */
int syslog_level;
GLogLevelFlags g_log_level;
} LogLevelDesc;
extern const LogLevelDesc level_desc[_LOGL_N];
gboolean _nm_log_parse_level (const char *level,
NMLogLevel *out_level);
#endif /* __NM_LOGGING_BASE_H__ */