cloud-setup: use _nm_log_simple_printf() for plain logging

This commit is contained in:
Thomas Haller 2021-07-21 12:55:39 +02:00
parent 764ca7462f
commit 391d714b19
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 2 additions and 44 deletions

View file

@ -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,

View file

@ -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 \