LogBackend: remove character set support
Always write UTF-8 to the log file.
This commit is contained in:
parent
73bd6af0f9
commit
9f4f1bab39
1
NEWS
1
NEWS
@ -25,6 +25,7 @@ ver 0.20 (not yet released)
|
|||||||
- soxr: allow multi-threaded resampling
|
- soxr: allow multi-threaded resampling
|
||||||
* reset song priority on playback
|
* reset song priority on playback
|
||||||
* write database and state file atomically
|
* write database and state file atomically
|
||||||
|
* always write UTF-8 to the log file.
|
||||||
* remove dependency on GLib
|
* remove dependency on GLib
|
||||||
* support libsystemd (instead of the older libsystemd-daemon)
|
* support libsystemd (instead of the older libsystemd-daemon)
|
||||||
* database
|
* database
|
||||||
|
@ -23,10 +23,6 @@
|
|||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
#include <glib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -65,10 +61,6 @@ ToAndroidLogLevel(LogLevel log_level)
|
|||||||
|
|
||||||
static LogLevel log_threshold = LogLevel::INFO;
|
static LogLevel log_threshold = LogLevel::INFO;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
static const char *log_charset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool enable_timestamp;
|
static bool enable_timestamp;
|
||||||
|
|
||||||
#ifdef HAVE_SYSLOG
|
#ifdef HAVE_SYSLOG
|
||||||
@ -81,16 +73,6 @@ SetLogThreshold(LogLevel _threshold)
|
|||||||
log_threshold = _threshold;
|
log_threshold = _threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
|
|
||||||
void
|
|
||||||
SetLogCharset(const char *_charset)
|
|
||||||
{
|
|
||||||
log_charset = _charset;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EnableLogTimestamp()
|
EnableLogTimestamp()
|
||||||
{
|
{
|
||||||
@ -175,20 +157,6 @@ LogFinishSysLog()
|
|||||||
static void
|
static void
|
||||||
FileLog(const Domain &domain, const char *message)
|
FileLog(const Domain &domain, const char *message)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
char *converted;
|
|
||||||
|
|
||||||
if (log_charset != nullptr) {
|
|
||||||
converted = g_convert_with_fallback(message, -1,
|
|
||||||
log_charset, "utf-8",
|
|
||||||
nullptr, nullptr,
|
|
||||||
nullptr, nullptr);
|
|
||||||
if (converted != nullptr)
|
|
||||||
message = converted;
|
|
||||||
} else
|
|
||||||
converted = nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, "%s%s: %.*s\n",
|
fprintf(stderr, "%s%s: %.*s\n",
|
||||||
enable_timestamp ? log_date() : "",
|
enable_timestamp ? log_date() : "",
|
||||||
domain.GetName(),
|
domain.GetName(),
|
||||||
@ -199,10 +167,6 @@ FileLog(const Domain &domain, const char *message)
|
|||||||
to have an effect on WIN32 */
|
to have an effect on WIN32 */
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
g_free(converted);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !ANDROID */
|
#endif /* !ANDROID */
|
||||||
|
@ -26,13 +26,6 @@
|
|||||||
void
|
void
|
||||||
SetLogThreshold(LogLevel _threshold);
|
SetLogThreshold(LogLevel _threshold);
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
|
|
||||||
void
|
|
||||||
SetLogCharset(const char *_charset);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EnableLogTimestamp();
|
EnableLogTimestamp();
|
||||||
|
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
#include <glib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -131,12 +127,6 @@ log_init(bool verbose, bool use_stdout, Error &error)
|
|||||||
#else
|
#else
|
||||||
const struct config_param *param;
|
const struct config_param *param;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
const char *charset;
|
|
||||||
g_get_charset(&charset);
|
|
||||||
SetLogCharset(charset);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
SetLogThreshold(LogLevel::DEBUG);
|
SetLogThreshold(LogLevel::DEBUG);
|
||||||
else if ((param = config_get_param(ConfigOption::LOG_LEVEL)) != nullptr)
|
else if ((param = config_get_param(ConfigOption::LOG_LEVEL)) != nullptr)
|
||||||
@ -216,10 +206,6 @@ void setup_log_output(bool use_stdout)
|
|||||||
redirect_logs(out_fd);
|
redirect_logs(out_fd);
|
||||||
close(out_fd);
|
close(out_fd);
|
||||||
out_fd = -1;
|
out_fd = -1;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
|
||||||
SetLogCharset(nullptr);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user