NetworkManager/shared/nm-glib-aux/nm-logging-base.c
Thomas Haller 88071abb43
all: unify comment style for SPDX-License-Identifier tag
Our coding style recommends C style comments (/* */) instead of C++
(//). Also, systemd (which we partly fork) uses C style comments for
the SPDX-License-Identifier.

Unify the style.

  $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
2020-09-29 16:50:53 +02:00

80 lines
1.5 KiB
C

/* SPDX-License-Identifier: LGPL-2.1+ */
#include "nm-default.h"
#include "nm-logging-base.h"
#include <syslog.h>
/*****************************************************************************/
const LogLevelDesc level_desc[_LOGL_N] = {
[LOGL_TRACE] =
{
"TRACE",
"<trace>",
LOG_DEBUG,
G_LOG_LEVEL_DEBUG,
},
[LOGL_DEBUG] =
{
"DEBUG",
"<debug>",
LOG_DEBUG,
G_LOG_LEVEL_DEBUG,
},
[LOGL_INFO] =
{
"INFO",
"<info>",
LOG_INFO,
G_LOG_LEVEL_INFO,
},
[LOGL_WARN] =
{
"WARN",
"<warn>",
LOG_WARNING,
G_LOG_LEVEL_MESSAGE,
},
[LOGL_ERR] =
{
"ERR",
"<error>",
LOG_ERR,
G_LOG_LEVEL_MESSAGE,
},
[_LOGL_OFF] =
{
"OFF",
NULL,
0,
0,
},
[_LOGL_KEEP] =
{
"KEEP",
NULL,
0,
0,
},
};
gboolean
_nm_log_parse_level(const char *level, NMLogLevel *out_level)
{
int i;
if (!level)
return FALSE;
for (i = 0; i < (int) G_N_ELEMENTS(level_desc); i++) {
if (!g_ascii_strcasecmp(level_desc[i].name, level)) {
NM_SET_OUT(out_level, i);
return TRUE;
}
}
return FALSE;
}