aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-01-08 04:31:44 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-01-08 04:31:44 +0000
commit438c1add9de7aff5968add3b9e02fac30a62e74a (patch)
tree3d4a982db74f0c6d7da66f8bf5e746217f8f9545 /src/log.c
parent90b4af03410cb151225853c458546abe6d696f1c (diff)
downloadmpd-438c1add9de7aff5968add3b9e02fac30a62e74a.tar.gz
mpd-438c1add9de7aff5968add3b9e02fac30a62e74a.tar.xz
mpd-438c1add9de7aff5968add3b9e02fac30a62e74a.zip
Convert log messages sent to stdout to the current locale's charset.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/log.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/log.c b/src/log.c
index 2e6eb3575..d38de4f25 100644
--- a/src/log.c
+++ b/src/log.c
@@ -21,6 +21,7 @@
#include "conf.h"
#include "myfprintf.h"
#include "utils.h"
+#include "localization.h"
#include <assert.h>
#include <stdlib.h>
@@ -86,9 +87,17 @@ static void buffer_warning(const char *fmt, va_list args)
static void do_log(FILE *fp, const char *fmt, va_list args)
{
- if (!stdout_mode)
+ char buffer[BUFFER_LENGTH + 1];
+ char *localized;
+
+ if (!stdout_mode) {
fwrite(log_date(), 15, 1, fp);
- vfprintf(fp, fmt, args);
+ vfprintf(fp, fmt, args);
+ } else {
+ vsnprintf(buffer, BUFFER_LENGTH, fmt, args);
+ localized = utf8ToLocaleCharset(buffer);
+ fputs(localized, fp);
+ }
}
void flushWarningLog(void)