wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
ErrorRedirector Class Reference

Redirect error messages (but not warnings) to a second target. More...

#include <ErrorRedirector.h>

Inheritance diagram for ErrorRedirector:
[legend]
Collaboration diagram for ErrorRedirector:
[legend]

Public Member Functions

 ErrorRedirector (std::unique_ptr< wxLog > &&newLog)
 Sets the specified logger (which may be NULL) as the default log target but the log messages are also passed to the previous log target if any.
 
virtual ~ErrorRedirector () override
 Restores the previous log target.
 
void Flush () override
 This method is called from the idle loop.
 
void DoLogRecord (wxLogLevel level, const wxString &msg, const wxLogRecordInfo &info) override
 
void DetachOldLog ()
 Detaches the old log target so it won't be destroyed when the wxLogChain object is destroyed.
 
void SetBatchMode ()
 Sets the "batch mode" flag that causes error messages to be output to stderr, as well.
 
wxLog * GetOldLog () const
 Returns the pointer to the previously active log target (which may be NULL).
 
void SetLog (std::unique_ptr< wxLog > &&logger)
 Sets and takes ownership of another log target to use (may be nullptr).
 
void SetLogThis ()
 Sets ourseves as the log target.
 

Static Public Member Functions

static void LogToStdErr ()
 Output all log messages to stderr, too.
 
static bool LoggingToStdErr ()
 Output all log messages to stderr, too.
 

Static Public Attributes

static int m_messages_logPaneOnly = 0
 A variable used by the SuppressErrorDialogs class.
 

Protected Attributes

wxLog * m_logNew = {}
 the current log target - equal to m_logOwned or this
 
wxLog *const m_logOld = {}
 the previous log target
 
std::unique_ptr< wxLog > m_logOwned
 the owned new log, of null if no log is owned
 
bool m_batchMode = false
 

Detailed Description

Redirect error messages (but not warnings) to a second target.

Member Function Documentation

◆ Flush()

void ErrorRedirector::Flush ( )
override

This method is called from the idle loop.

All log targets collect log messages between calls to Flush.

◆ SetLog()

void ErrorRedirector::SetLog ( std::unique_ptr< wxLog > &&  logger)

Sets and takes ownership of another log target to use (may be nullptr).

The previously owned logger - if any - is destroyed. This doesn't change the old log target value (the one the messages are forwarded to) which still remains the same as was active when wxLogChain object was created.

Field Documentation

◆ m_messages_logPaneOnly

int ErrorRedirector::m_messages_logPaneOnly = 0
static

A variable used by the SuppressErrorDialogs class.

>=0 means: Messages should appear in the log pane only.


The documentation for this class was generated from the following files: