logging: add new logging level "TRACE"

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-04-14 14:26:13 +02:00
parent c9e0e66a80
commit bdea7d61d0
11 changed files with 29 additions and 19 deletions

View file

@ -217,7 +217,7 @@
</tp:docstring>
<arg name="level" type="s" direction="in">
<tp:docstring>
One of [ERR, WARN, INFO, DEBUG].
One of [ERR, WARN, INFO, DEBUG, TRACE].
</tp:docstring>
</arg>
<arg name="domains" type="s" direction="in">
@ -246,7 +246,7 @@
</tp:docstring>
<arg name="level" type="s" direction="out">
<tp:docstring>
One of [ERR, WARN, INFO, DEBUG].
One of [ERR, WARN, INFO, DEBUG, TRACE].
</tp:docstring>
</arg>
<arg name="domains" type="s" direction="out">

View file

@ -316,11 +316,12 @@ unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth
<listitem><para>The default logging verbosity level.
One of <literal>ERR</literal>,
<literal>WARN</literal>, <literal>INFO</literal>,
<literal>DEBUG</literal>. The ERR level logs only critical
errors. WARN logs warnings that may reflect operation.
INFO logs various informational messages that are useful for
tracking state and operations. DEBUG enables verbose
logging for debugging purposes. Subsequent levels also log
<literal>DEBUG</literal>, <literal>TRACE</literal>. The ERR
level logs only critical errors. WARN logs warnings that may
reflect operation. INFO logs various informational messages that
are useful for tracking state and operations. DEBUG enables
verbose logging for debugging purposes. TRACE enables even more
verbose logging then DEBUG level. Subsequent levels also log
all messages from earlier levels; thus setting the log level
to INFO also logs error and warning messages.</para></listitem>
</varlistentry>

View file

@ -2532,8 +2532,8 @@ msgstr "plugin1,plugin2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:384
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgstr "Επίπεδο καταγραφής: ένα από τα [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr "Επίπεδο καταγραφής: ένα από τα [ERR, WARN, INFO, DEBUG, TRACE]"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:387

View file

@ -2469,8 +2469,8 @@ msgstr "plugin1,plugin2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:384
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgstr "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:387

View file

@ -2321,7 +2321,7 @@ msgstr ""
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:376
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr ""
#. Translators: Do not translate the values in the square brackets

View file

@ -2608,8 +2608,8 @@ msgstr "engadido1,engadido2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:371
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgstr "Nivel de rexistroÑ un de [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr "Nivel de rexistroÑ un de [ERR, WARN, INFO, DEBUG, TRACE]"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:374

View file

@ -2463,8 +2463,8 @@ msgstr "plugin1,plugin2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:384
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgstr "Aras log: satu dari [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr "Aras log: satu dari [ERR, WARN, INFO, DEBUG, TRACE]"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:387

View file

@ -2593,8 +2593,8 @@ msgstr "vstavek1,vstavek2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:383
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgstr "Raven beleženja: ena izmed [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr "Raven beleženja: ena izmed [ERR, WARN, INFO, DEBUG, TRACE]"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:386

View file

@ -2935,7 +2935,7 @@ msgstr "eklenti1,eklenti2"
#. Translators: Do not translate the values in the square brackets
#: ../src/main.c:336
msgid "Log level: one of [ERR, WARN, INFO, DEBUG]"
msgid "Log level: one of [ERR, WARN, INFO, DEBUG, TRACE]"
msgstr ""
#. Translators: Do not translate the values in the square brackets

View file

@ -68,6 +68,7 @@ typedef struct {
} LogDesc;
static const char *level_names[LOGL_MAX] = {
[LOGL_TRACE] = "TRACE",
[LOGL_DEBUG] = "DEBUG",
[LOGL_INFO] = "INFO",
[LOGL_WARN] = "WARN",
@ -405,6 +406,12 @@ _nm_log (const char *loc,
va_end (args);
switch (level) {
case LOGL_TRACE:
g_get_current_time (&tv);
syslog_level = LOG_DEBUG;
g_log_level = G_LOG_LEVEL_DEBUG;
fullmsg = g_strdup_printf ("<trace> [%ld.%06ld] [%s] %s(): %s", tv.tv_sec, tv.tv_usec, loc, func, msg);
break;
case LOGL_DEBUG:
g_get_current_time (&tv);
syslog_level = LOG_INFO;

View file

@ -77,6 +77,7 @@ enum {
/* Log levels */
enum {
LOGL_TRACE,
LOGL_DEBUG,
LOGL_INFO,
LOGL_WARN,
@ -98,6 +99,7 @@ GQuark nm_logging_error_quark (void);
#define nm_log_warn(domain, ...) nm_log (LOGL_WARN, (domain), __VA_ARGS__)
#define nm_log_info(domain, ...) nm_log (LOGL_INFO, (domain), __VA_ARGS__)
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), __VA_ARGS__)
#define nm_log_trace(domain, ...) nm_log (LOGL_TRACE, (domain), __VA_ARGS__)
/* nm_log() only evaluates it's argument list after checking
* whether logging for the given level/domain is enabled. */