move logging stuff into archhooks
This commit is contained in:
@@ -11,13 +11,11 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "StepMania.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
/* XXX */
|
|
||||||
#include "archutils/win32/crash.h"
|
|
||||||
|
|
||||||
RageLog* LOG; // global and accessable from anywhere in the program
|
RageLog* LOG; // global and accessable from anywhere in the program
|
||||||
|
|
||||||
/* We have a couple log types and a couple logs.
|
/* 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
|
/* staticlog gets info.txt
|
||||||
* crashlog gets log.txt */
|
* crashlog gets log.txt */
|
||||||
enum {
|
enum {
|
||||||
TO_LOG = 0x01,
|
TO_INFO = 0x01,
|
||||||
TO_INFO = 0x02,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RageLog::RageLog()
|
RageLog::RageLog()
|
||||||
@@ -140,15 +137,12 @@ void RageLog::Write( int where, CString str)
|
|||||||
if( m_fileLog )
|
if( m_fileLog )
|
||||||
fprintf(m_fileLog, "%s\n", str.GetString() );
|
fprintf(m_fileLog, "%s\n", str.GetString() );
|
||||||
|
|
||||||
if( where & TO_INFO )
|
if( where & TO_INFO && m_fileInfo )
|
||||||
{
|
|
||||||
if( m_fileInfo )
|
|
||||||
fprintf(m_fileInfo, "%s\n", str.GetString() );
|
fprintf(m_fileInfo, "%s\n", str.GetString() );
|
||||||
StaticLog(str);
|
|
||||||
}
|
HOOKS->Log(str, where & TO_INFO);
|
||||||
|
|
||||||
printf("%s\n", str.GetString() );
|
printf("%s\n", str.GetString() );
|
||||||
CrashLog(str);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Flush();
|
Flush();
|
||||||
@@ -161,4 +155,5 @@ void RageLog::Write( int where, CString str)
|
|||||||
void RageLog::Flush()
|
void RageLog::Flush()
|
||||||
{
|
{
|
||||||
fflush( m_fileLog );
|
fflush( m_fileLog );
|
||||||
|
fflush( m_fileInfo );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
class ArchHooks
|
class ArchHooks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/* This receives all logs. 'important' is set for Warn and Info. */
|
||||||
|
virtual void Log(CString str, bool important) { }
|
||||||
virtual ~ArchHooks() { }
|
virtual ~ArchHooks() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,16 @@ ArchHooks_Win32::ArchHooks_Win32()
|
|||||||
VDCHECKPOINT;
|
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.
|
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class ArchHooks_Win32: public ArchHooks
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArchHooks_Win32();
|
ArchHooks_Win32();
|
||||||
|
void Log(CString str, bool important);
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef ARCH_HOOKS
|
#undef ARCH_HOOKS
|
||||||
|
|||||||
Reference in New Issue
Block a user