[8390] Fixed log output work after recent replace UTF8PRINT macro.

This commit is contained in:
VladimirMangos 2009-08-19 01:56:20 +04:00
parent 35121cdd34
commit 0ae528775d
4 changed files with 55 additions and 25 deletions

View file

@ -369,7 +369,11 @@ void Log::outString( const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -379,7 +383,6 @@ void Log::outString( const char * str, ... )
{
outTimestamp(logfile);
va_list ap;
va_start(ap, str);
vfprintf(logfile, str, ap);
fprintf(logfile, "\n" );
@ -401,7 +404,11 @@ void Log::outError( const char * err, ... )
if(m_includeTime)
outTime();
utf8printf(stderr, err);
va_list ap;
va_start(ap, err);
vutf8printf(stderr, err, &ap);
va_end(ap);
if(m_colored)
ResetColor(false);
@ -412,7 +419,6 @@ void Log::outError( const char * err, ... )
outTimestamp(logfile);
fprintf(logfile, "ERROR:" );
va_list ap;
va_start(ap, err);
vfprintf(logfile, err, ap);
va_end(ap);
@ -434,7 +440,11 @@ void Log::outErrorDb( const char * err, ... )
if(m_includeTime)
outTime();
utf8printf(stderr, err);
va_list ap;
va_start(ap, err);
vutf8printf(stderr, err, &ap);
va_end(ap);
if(m_colored)
ResetColor(false);
@ -446,7 +456,6 @@ void Log::outErrorDb( const char * err, ... )
outTimestamp(logfile);
fprintf(logfile, "ERROR:" );
va_list ap;
va_start(ap, err);
vfprintf(logfile, err, ap);
va_end(ap);
@ -483,7 +492,10 @@ void Log::outBasic( const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -518,7 +530,10 @@ void Log::outDetail( const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -527,12 +542,14 @@ void Log::outDetail( const char * str, ... )
}
if(logfile && m_logFileLevel > 1)
{
va_list ap;
outTimestamp(logfile);
va_list ap;
va_start(ap, str);
vfprintf(logfile, str, ap);
fprintf(logfile, "\n" );
va_end(ap);
fprintf(logfile, "\n" );
fflush(logfile);
}
@ -548,7 +565,10 @@ void Log::outDebugInLine( const char * str, ... )
if(m_colored)
SetColor(true,m_colors[LogDebug]);
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -574,7 +594,10 @@ void Log::outDebug( const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -609,7 +632,10 @@ void Log::outCommand( uint32 account, const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
if(m_colored)
ResetColor(true);
@ -691,7 +717,11 @@ void Log::outMenu( const char * str, ... )
if(m_includeTime)
outTime();
utf8printf(stdout, str);
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
ResetColor(true);
@ -699,7 +729,6 @@ void Log::outMenu( const char * str, ... )
{
outTimestamp(logfile);
va_list ap;
va_start(ap, str);
vfprintf(logfile, str, ap);
va_end(ap);

View file

@ -423,25 +423,25 @@ bool Utf8FitTo(const std::string& str, std::wstring search)
void utf8printf(FILE *out, const char *str, ...)
{
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
}
void vutf8printf(FILE *out, const char *str, va_list* ap)
{
#if PLATFORM == PLATFORM_WINDOWS
char temp_buf[32*1024];
wchar_t wtemp_buf[32*1024];
size_t temp_len;
size_t wtemp_len;
va_start(ap, str);
temp_len = vsnprintf(temp_buf, 32*1024, str, ap);
va_end(ap);
size_t temp_len = vsnprintf(temp_buf, 32*1024, str, *ap);
wtemp_len = 32*1024-1;
size_t wtemp_len = 32*1024-1;
Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len);
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1);
fprintf(out, temp_buf);
#else
va_start(ap, str);
vfprintf(out, str, ap);
va_end(ap);
vfprintf(out, str, *ap);
#endif
}

View file

@ -284,6 +284,7 @@ bool utf8ToConsole(const std::string& utf8str, std::string& conStr);
bool consoleToUtf8(const std::string& conStr,std::string& utf8str);
bool Utf8FitTo(const std::string& str, std::wstring search);
void utf8printf(FILE *out, const char *str, ...);
void vutf8printf(FILE *out, const char *str, va_list* ap);
bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8389"
#define REVISION_NR "8390"
#endif // __REVISION_NR_H__