diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index ede8f29ae8..f76a74487c 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -34,7 +34,6 @@ RageLog::RageLog() // Open log file and leave it open. Let the OS close it when the app exits m_fileLog = fopen( LOG_FILE_NAME, "w" ); - SYSTEMTIME st; GetLocalTime( &st ); @@ -64,37 +63,38 @@ void RageLog::HideConsole() FreeConsole(); } -void RageLog::Trace( LPCTSTR fmt, ...) +void RageLog::Trace( const char *fmt, ...) { va_list va; va_start(va, fmt); - CString sBuff = vssprintf( fmt, va ); - sBuff += "\n"; + va_end(va); - fprintf( m_fileLog, sBuff ); - printf( sBuff ); + fprintf( m_fileLog, "%s\n", sBuff ); + printf( "%s\n", sBuff ); #ifdef DEBUG this->Flush(); // implicit flush #endif } -void RageLog::Trace( HRESULT hr, LPCTSTR fmt, ...) +void RageLog::Trace( HRESULT hr, const char *fmt, ...) { va_list va; va_start(va, fmt); CString s = vssprintf( fmt, va ); + va_end(va); + s += ssprintf( "(%s)", DXGetErrorString8(hr) ); - this->Trace( s ); + this->Trace( "%s", s ); } -void RageLog::Warn( LPCTSTR fmt, ...) +void RageLog::Warn( const char *fmt, ...) { va_list va; va_start(va, fmt); - CString sBuff = vssprintf( fmt, va ); + va_end(va); Trace( "/////////////////////////////////////////\n" "WARNING: %s\n" diff --git a/stepmania/src/RageLog.h b/stepmania/src/RageLog.h index 5352b678fe..7514287c8d 100644 --- a/stepmania/src/RageLog.h +++ b/stepmania/src/RageLog.h @@ -1,4 +1,6 @@ -#pragma once +#ifndef RAGELOG_H +#define RAGELOG_H + /* ----------------------------------------------------------------------------- Class: RageLog @@ -10,6 +12,7 @@ ----------------------------------------------------------------------------- */ +#include class RageLog { @@ -17,9 +20,9 @@ public: RageLog(); ~RageLog(); - void Trace( LPCTSTR fmt, ...); - void Trace( HRESULT hr, LPCTSTR fmt, ...); - void Warn( LPCTSTR fmt, ...); + void Trace( const char *fmt, ...); + void Trace( HRESULT hr, const char *fmt, ...); + void Warn( const char *fmt, ...); void Flush(); void ShowConsole(); @@ -30,3 +33,5 @@ protected: }; extern RageLog* LOG; // global and accessable from anywhere in our program + +#endif \ No newline at end of file