diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index 488e5bb7c8..588e27aa5d 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -11,13 +11,11 @@ ----------------------------------------------------------------------------- */ +#include "StepMania.h" #include "RageLog.h" #include "RageUtil.h" #include -/* XXX */ -#include "archutils/win32/crash.h" - RageLog* LOG; // global and accessable from anywhere in the program /* We have a couple log types and a couple logs. @@ -48,8 +46,7 @@ RageLog* LOG; // global and accessable from anywhere in the program /* staticlog gets info.txt * crashlog gets log.txt */ enum { - TO_LOG = 0x01, - TO_INFO = 0x02, + TO_INFO = 0x01, }; RageLog::RageLog() @@ -140,15 +137,12 @@ void RageLog::Write( int where, CString str) if( m_fileLog ) fprintf(m_fileLog, "%s\n", str.GetString() ); - if( where & TO_INFO ) - { - if( m_fileInfo ) - fprintf(m_fileInfo, "%s\n", str.GetString() ); - StaticLog(str); - } + if( where & TO_INFO && m_fileInfo ) + fprintf(m_fileInfo, "%s\n", str.GetString() ); + + HOOKS->Log(str, where & TO_INFO); printf("%s\n", str.GetString() ); - CrashLog(str); #ifdef DEBUG Flush(); @@ -161,4 +155,5 @@ void RageLog::Write( int where, CString str) void RageLog::Flush() { fflush( m_fileLog ); + fflush( m_fileInfo ); } diff --git a/stepmania/src/arch/ArchHooks/ArchHooks.h b/stepmania/src/arch/ArchHooks/ArchHooks.h index 1dcaa303bf..b0b06766ad 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks.h @@ -18,6 +18,8 @@ class ArchHooks { public: + /* This receives all logs. 'important' is set for Warn and Info. */ + virtual void Log(CString str, bool important) { } virtual ~ArchHooks() { } }; diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.cpp b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.cpp index 98cd95f862..c6cfde4e20 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.cpp @@ -11,6 +11,16 @@ ArchHooks_Win32::ArchHooks_Win32() VDCHECKPOINT; } +void ArchHooks_Win32::Log(CString str, bool important) +{ + /* It's OK to send to both of these; it'll let us know when important + * events occurred in crash dumps if they're recent. */ + if(important) + StaticLog(str); + + CrashLog(str); +} + /* * Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved. * diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h index 20bf8ebc7f..6a8d80503f 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h @@ -6,6 +6,7 @@ class ArchHooks_Win32: public ArchHooks { public: ArchHooks_Win32(); + void Log(CString str, bool important); }; #undef ARCH_HOOKS