Joined work of nakee and mine, cleanup the logging code a bit.

This solves the random __Log symbol and crash problem on linux
Please tell us if you find problems in the logging code


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2009-02-04 15:28:39 +00:00
parent c43d8e9dcd
commit 77215fd27c
10 changed files with 60 additions and 181 deletions

View File

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#if defined(HAVE_WX) && HAVE_WX
#include <wx/wx.h>
#include <wx/filepicker.h>
@ -35,41 +32,26 @@
#include "IniFile.h"
#include "ConsoleWindow.h"
#include <assert.h>
/////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Open and close the Windows console window
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#ifdef _WIN32
void OpenConsole()
{
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
Console::Print("OpenGL console opened\n");
#ifdef _WIN32
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
// adjustable from the debugging window
#endif
}
void CloseConsole()
{
Console::Close();
}
#else
// Dummy functions for console open/close
void OpenConsole()
{
}
void CloseConsole()
{
}
#endif
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Write logs
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// The log file handle
static FILE* pfLog = NULL;
@ -77,6 +59,7 @@ static FILE* pfLog = NULL;
// This is on by default, but can be controlled from the debugging window
bool LocalLogFile = true;
#ifdef LOGGING
void __Log(const char *fmt, ...)
{
char* Msg = (char*)alloca(strlen(fmt)+512);
@ -96,12 +79,8 @@ void __Log(const char *fmt, ...)
if (pfLog != NULL && LocalLogFile)
fwrite(Msg, strlen(Msg), 1, pfLog);
#ifdef _WIN32
// Write to the console screen, if one exists
Console::Print(Msg);
#else
//printf("%s", Msg);
#endif
Console::Print(Msg);
}
void __Log(int type, const char *fmt, ...)
@ -114,10 +93,7 @@ void __Log(int type, const char *fmt, ...)
va_end( ap );
g_VideoInitialize.pLog(Msg, FALSE);
#ifdef _WIN32
// Write to the console screen, if one exists
Console::Print(Msg);
#endif
}
//////////////////////////////////
#endif