summary refs log tree commit diff
path: root/shared/nm-glib-aux/nm-logging-base.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-10-05 22:27:18 +0200
committerMichael Biebl <biebl@debian.org>2020-10-05 22:27:18 +0200
commitaafc1dbe4712c86189bbc1d4d54ad8cb4c69be7e (patch)
treea2a9bb4d007339a0b1304540388230ccedac32bd /shared/nm-glib-aux/nm-logging-base.c
parente7b44ef4c80907346ec7492a09c45277459924fc (diff)
New upstream version 1.27.90 upstream/1.27.90
Diffstat (limited to 'shared/nm-glib-aux/nm-logging-base.c')
-rw-r--r--shared/nm-glib-aux/nm-logging-base.c81
1 files changed, 61 insertions, 20 deletions
diff --git a/shared/nm-glib-aux/nm-logging-base.c b/shared/nm-glib-aux/nm-logging-base.c
index 47b3e993..229470f6 100644
--- a/shared/nm-glib-aux/nm-logging-base.c
+++ b/shared/nm-glib-aux/nm-logging-base.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 
 #include "nm-default.h"
 
@@ -9,30 +9,71 @@
 /*****************************************************************************/
 
 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,                   },
+    [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)
+_nm_log_parse_level(const char *level, NMLogLevel *out_level)
 {
-	int i;
+    int i;
 
-	if (!level)
-		return FALSE;
+    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;
-		}
-	}
+    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;
+    return FALSE;
 }