mirror of https://github.com/PCSX2/pcsx2.git
console: Remove buffered and wxerror console writers
Both haven't been used for a long time, and don't seem to hold any advantages over the default stdout console writer.
This commit is contained in:
parent
f338ffea74
commit
c9a1097579
|
@ -238,15 +238,10 @@ extern IConsoleWriter Console;
|
||||||
extern void Console_SetStdout(FILE *fp);
|
extern void Console_SetStdout(FILE *fp);
|
||||||
#endif
|
#endif
|
||||||
extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL );
|
extern void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp=NULL );
|
||||||
extern const wxString& ConsoleBuffer_Get();
|
|
||||||
extern void ConsoleBuffer_Clear();
|
|
||||||
extern void ConsoleBuffer_FlushToFile( FILE *fp );
|
|
||||||
|
|
||||||
extern const IConsoleWriter ConsoleWriter_Null;
|
extern const IConsoleWriter ConsoleWriter_Null;
|
||||||
extern const IConsoleWriter ConsoleWriter_Stdout;
|
extern const IConsoleWriter ConsoleWriter_Stdout;
|
||||||
extern const IConsoleWriter ConsoleWriter_Assert;
|
extern const IConsoleWriter ConsoleWriter_Assert;
|
||||||
extern const IConsoleWriter ConsoleWriter_Buffered;
|
|
||||||
extern const IConsoleWriter ConsoleWriter_wxError;
|
|
||||||
|
|
||||||
extern NullConsoleWriter NullCon;
|
extern NullConsoleWriter NullCon;
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,6 @@ static DeclareTls(int) conlog_Indent( 0 );
|
||||||
// thread-local console color storage.
|
// thread-local console color storage.
|
||||||
static DeclareTls(ConsoleColors) conlog_Color( DefaultConsoleColor );
|
static DeclareTls(ConsoleColors) conlog_Color( DefaultConsoleColor );
|
||||||
|
|
||||||
|
|
||||||
static wxString m_buffer; // used by ConsoleBuffer
|
|
||||||
static Mutex m_bufferlock; // used by ConsoleBuffer
|
|
||||||
|
|
||||||
#ifdef __POSIX__
|
#ifdef __POSIX__
|
||||||
static FILE *stdout_fp = stdout;
|
static FILE *stdout_fp = stdout;
|
||||||
|
|
||||||
|
@ -57,13 +53,6 @@ void Console_SetActiveHandler( const IConsoleWriter& writer, FILE* flushfp )
|
||||||
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented."
|
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented."
|
||||||
);
|
);
|
||||||
|
|
||||||
if( &writer != &ConsoleWriter_Buffered )
|
|
||||||
{
|
|
||||||
ScopedLock lock( m_bufferlock );
|
|
||||||
if( !ConsoleBuffer_Get().IsEmpty() )
|
|
||||||
writer.DoWriteLn( ConsoleBuffer_Get() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Console = writer;
|
Console = writer;
|
||||||
DevConWriter = writer;
|
DevConWriter = writer;
|
||||||
|
|
||||||
|
@ -228,83 +217,6 @@ const IConsoleWriter ConsoleWriter_Assert =
|
||||||
0, // instance-level indentation (should always be 0)
|
0, // instance-level indentation (should always be 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
|
||||||
// ConsoleBuffer
|
|
||||||
// --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const wxString& ConsoleBuffer_Get()
|
|
||||||
{
|
|
||||||
return m_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConsoleBuffer_Clear()
|
|
||||||
{
|
|
||||||
ScopedLock lock( m_bufferlock );
|
|
||||||
m_buffer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flushes the contents of the ConsoleBuffer to the specified destination file stream, and
|
|
||||||
// clears the buffer contents to 0.
|
|
||||||
void ConsoleBuffer_FlushToFile( FILE *fp )
|
|
||||||
{
|
|
||||||
ScopedLock lock( m_bufferlock );
|
|
||||||
if( fp == NULL || m_buffer.IsEmpty() ) return;
|
|
||||||
px_fputs( fp, m_buffer.ToUTF8() );
|
|
||||||
m_buffer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __concall ConsoleBuffer_DoWrite( const wxString& fmt )
|
|
||||||
{
|
|
||||||
ScopedLock lock( m_bufferlock );
|
|
||||||
m_buffer += fmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __concall ConsoleBuffer_DoWriteLn( const wxString& fmt )
|
|
||||||
{
|
|
||||||
ScopedLock lock( m_bufferlock );
|
|
||||||
m_buffer += fmt + L"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
const IConsoleWriter ConsoleWriter_Buffered =
|
|
||||||
{
|
|
||||||
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid assertion spam.
|
|
||||||
ConsoleBuffer_DoWriteLn,
|
|
||||||
ConsoleNull_DoSetColor,
|
|
||||||
|
|
||||||
ConsoleBuffer_DoWrite,
|
|
||||||
ConsoleNull_Newline,
|
|
||||||
ConsoleNull_SetTitle,
|
|
||||||
|
|
||||||
0, // instance-level indentation (should always be 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
|
||||||
// Console_wxLogError
|
|
||||||
// --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static void __concall Console_wxLogError_DoWriteLn( const wxString& fmt )
|
|
||||||
{
|
|
||||||
if( !m_buffer.IsEmpty() )
|
|
||||||
{
|
|
||||||
wxLogError( m_buffer );
|
|
||||||
m_buffer.clear();
|
|
||||||
}
|
|
||||||
wxLogError( fmt );
|
|
||||||
}
|
|
||||||
|
|
||||||
const IConsoleWriter ConsoleWriter_wxError =
|
|
||||||
{
|
|
||||||
ConsoleBuffer_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
|
||||||
Console_wxLogError_DoWriteLn,
|
|
||||||
ConsoleNull_DoSetColor,
|
|
||||||
|
|
||||||
ConsoleBuffer_DoWrite,
|
|
||||||
ConsoleNull_Newline,
|
|
||||||
ConsoleNull_SetTitle,
|
|
||||||
|
|
||||||
0, // instance-level indentation (should always be 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
// =====================================================================================================
|
// =====================================================================================================
|
||||||
// IConsoleWriter (implementations)
|
// IConsoleWriter (implementations)
|
||||||
// =====================================================================================================
|
// =====================================================================================================
|
||||||
|
|
Loading…
Reference in New Issue