diff options
Diffstat (limited to 'src/nm-logging.c')
| -rw-r--r-- | src/nm-logging.c | 55 |
1 files changed, 5 insertions, 50 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c index ea505a81..34dd2797 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -1,19 +1,5 @@ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * +// SPDX-License-Identifier: GPL-2.0+ +/* * Copyright (C) 2006 - 2012 Red Hat, Inc. * Copyright (C) 2006 - 2008 Novell, Inc. */ @@ -36,6 +22,7 @@ #include <systemd/sd-journal.h> #endif +#include "nm-glib-aux/nm-logging-base.h" #include "nm-glib-aux/nm-time-utils.h" #include "nm-errors.h" @@ -99,22 +86,6 @@ typedef struct { } LogDesc; 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; - -typedef struct { char *logging_domains_to_string; } GlobalMain; @@ -172,16 +143,6 @@ NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL] = { /*****************************************************************************/ -static 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, }, -}; - static const LogDesc domain_desc[] = { { LOGD_PLATFORM, "PLATFORM" }, { LOGD_RFKILL, "RFKILL" }, @@ -285,14 +246,8 @@ match_log_level (const char *level, NMLogLevel *out_level, GError **error) { - int i; - - for (i = 0; i < G_N_ELEMENTS (level_desc); i++) { - if (!g_ascii_strcasecmp (level_desc[i].name, level)) { - *out_level = i; - return TRUE; - } - } + if (_nm_log_parse_level (level, out_level)) + return TRUE; g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_LOG_LEVEL, _("Unknown log level '%s'"), level); |