mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-23 19:24:38 +00:00
cloud-setup: use _nm_log_simple_printf() for plain logging
This commit is contained in:
parent
764ca7462f
commit
391d714b19
|
@ -28,46 +28,6 @@ _nm_logging_enabled_init(const char *level_str)
|
|||
_nm_logging_configured_level = level;
|
||||
}
|
||||
|
||||
void
|
||||
_nm_log_impl_cs(NMLogLevel level, const char *fmt, ...)
|
||||
{
|
||||
gs_free char *msg = NULL;
|
||||
va_list ap;
|
||||
const char * level_str;
|
||||
gint64 ts;
|
||||
|
||||
va_start(ap, fmt);
|
||||
msg = g_strdup_vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
switch (level) {
|
||||
case LOGL_TRACE:
|
||||
level_str = "<trace>";
|
||||
break;
|
||||
case LOGL_DEBUG:
|
||||
level_str = "<debug>";
|
||||
break;
|
||||
case LOGL_INFO:
|
||||
level_str = "<info> ";
|
||||
break;
|
||||
case LOGL_WARN:
|
||||
level_str = "<warn> ";
|
||||
break;
|
||||
default:
|
||||
nm_assert(level == LOGL_ERR);
|
||||
level_str = "<error>";
|
||||
break;
|
||||
}
|
||||
|
||||
ts = nm_utils_clock_gettime_nsec(CLOCK_BOOTTIME);
|
||||
|
||||
g_print("[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s %s\n",
|
||||
ts / NM_UTILS_NSEC_PER_SEC,
|
||||
(ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000,
|
||||
level_str,
|
||||
msg);
|
||||
}
|
||||
|
||||
void
|
||||
_nm_utils_monotonic_timestamp_initialized(const struct timespec *tp,
|
||||
gint64 offset_sec,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef __NM_CLOUD_SETUP_UTILS_H__
|
||||
#define __NM_CLOUD_SETUP_UTILS_H__
|
||||
|
||||
#include "libnm-glib-aux/nm-logging-fwd.h"
|
||||
#include "libnm-glib-aux/nm-logging-base.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
@ -23,9 +23,7 @@ nm_logging_enabled(NMLogLevel level)
|
|||
|
||||
void _nm_logging_enabled_init(const char *level_str);
|
||||
|
||||
void _nm_log_impl_cs(NMLogLevel level, const char *fmt, ...) _nm_printf(2, 3);
|
||||
|
||||
#define _nm_log(level, ...) _nm_log_impl_cs((level), __VA_ARGS__);
|
||||
#define _nm_log(level, ...) _nm_log_simple_printf((level), __VA_ARGS__);
|
||||
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START \
|
||||
|
|
Loading…
Reference in a new issue