diff options
| author | Tomas Bzatek <tbzatek@redhat.com> | 2024-01-19 18:26:34 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@redhat.com> | 2024-01-19 18:26:34 +0100 |
| commit | a55d09bb2d74944b7ea5a7e81b7d3e86bc04cd42 (patch) | |
| tree | 7b2229b1fce0b342d1968069eae98a3be4afc3a8 /common/strutils.c | |
| parent | e9036281ebb3a5be97e42f56667bb8dfebc5b4fe (diff) | |
| download | tuxcmd-modules-a55d09bb2d74944b7ea5a7e81b7d3e86bc04cd42.tar.xz | |
common: Logging rework
Use common logging macros for a consistent output. A logging domain
needs to be set in a Makefile first (the _LOG_DOMAIN define).
Heavy debugging output is guarded by the __DEBUG_INTERNAL define
and omitted by default.
Logging severity is controlled by the TUXCMD_DEBUG env. var,
typically set by the tuxcmd process itself.
Diffstat (limited to 'common/strutils.c')
| -rw-r--r-- | common/strutils.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/common/strutils.c b/common/strutils.c index 3b0a1db..a877c2e 100644 --- a/common/strutils.c +++ b/common/strutils.c @@ -18,10 +18,11 @@ */ #include <string.h> +#include <syslog.h> #include <glib.h> #include "strutils.h" - +#include "logutils.h" char * @@ -85,9 +86,9 @@ resolve_relative (const char *source, const char *point_to) return g_strdup (point_to); rel = g_build_filename (source, point_to, NULL); - log ("resolve_relative: rel = '%s'\n", rel); + log_debug ("resolve_relative: rel = '%s'", rel); canon = canonicalize_filename (rel); - log ("resolve_relative: canon = '%s'\n", canon); + log_debug ("resolve_relative: canon = '%s'", canon); g_free (rel); return canon; @@ -214,7 +215,7 @@ wide_to_utf8 (const wchar_t *src) if (ch < 0x80) /* 0x00-0x7f: 1 byte */ { if (!len--) { - log ("wide_to_utf8: error converting input string, overflow.\n"); + log_debug ("wide_to_utf8: error converting input string, overflow."); break; /* overflow */ } *dst++ = ch; @@ -224,7 +225,7 @@ wide_to_utf8 (const wchar_t *src) if (ch < 0x800) /* 0x80-0x7ff: 2 bytes */ { if ((len -= 2) < 0) { - log ("wide_to_utf8: error converting input string, overflow.\n"); + log_debug ("wide_to_utf8: error converting input string, overflow."); break; /* overflow */ } dst[1] = 0x80 | (ch & 0x3f); @@ -236,7 +237,7 @@ wide_to_utf8 (const wchar_t *src) /* 0x800-0xffff: 3 bytes */ if ((len -= 3) < 0) { - log ("wide_to_utf8: error converting input string, overflow.\n"); + log_debug ("wide_to_utf8: error converting input string, overflow."); break; /* overflow */ } dst[2] = 0x80 | (ch & 0x3f); |
