move logging stuff into archhooks

This commit is contained in:
Glenn Maynard
2003-01-24 23:24:14 +00:00
parent 4c8c2b15e5
commit 78aecb4dbb
4 changed files with 20 additions and 12 deletions
+7 -12
View File
@@ -11,13 +11,11 @@
-----------------------------------------------------------------------------
*/
#include "StepMania.h"
#include "RageLog.h"
#include "RageUtil.h"
#include <fstream>
/* 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 );
}
+2
View File
@@ -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() { }
};
@@ -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.
*
@@ -6,6 +6,7 @@ class ArchHooks_Win32: public ArchHooks
{
public:
ArchHooks_Win32();
void Log(CString str, bool important);
};
#undef ARCH_HOOKS