![]() |
wxIScan
|
A class to split the log output into a wxLogGui and a wxTextCtrl target. More...
#include <wxchainlogtextctrl.h>
Public Member Functions | |
wxChainLogTextCtrl (wxTextCtrl *poTextctrl, wxLogLevel nMaxLevel=2) | |
Standard constructor. | |
Protected Member Functions | |
virtual void | DoLog (wxLogLevel nLevel, const wxChar *pszMessage, time_t nTimestamp) |
Internally called function to process the log message. | |
Protected Attributes | |
wxLogLevel | m_nMaxLevel |
A class to split the log output into a wxLogGui and a wxTextCtrl target.
This is a simple to use class in order to replace the current log target by twice a) a GUI window log with threshold, and b) a text control to log long lists of log output.
Definition at line 24 of file wxchainlogtextctrl.h.
wxChainLogTextCtrl::wxChainLogTextCtrl | ( | wxTextCtrl * | poTextctrl, |
wxLogLevel | nMaxLevel = 2 |
||
) | [inline] |
Standard constructor.
poTextctrl | A pointer to a wxTextCtrl object, that is used as an addition |
nMaxLevel | Refence log level for to suppress messages with higher level, defaults to 2 (errors) |
Definition at line 32 of file wxchainlogtextctrl.h.
References m_nMaxLevel.
{ // Save log level. m_nMaxLevel= nMaxLevel; // Set this object as the new log target. wxLog::SetActiveTarget( this ); // Chain the log to the wxTextCtrl object. new wxLogChain( new wxLogTextCtrl( poTextctrl ) ); }
virtual void wxChainLogTextCtrl::DoLog | ( | wxLogLevel | nLevel, |
const wxChar * | pszMessage, | ||
time_t | nTimestamp | ||
) | [inline, protected, virtual] |
Internally called function to process the log message.
Suppress the log output if the given log level is higher then m_nMaxLevel. So it is possible to get only error messages shown in the normal dialog window while anything else is logged to the chained wxTextCtrl object.
oLevel | Log level |
pszMessage | Message to log |
nTimestamp | Timestamp of the message |
Definition at line 77 of file wxchainlogtextctrl.h.
References m_nMaxLevel.
{ // Show message only if the log level is lower or equal to the reference value. if( nLevel <= m_nMaxLevel ) { // Show message using parent function. // // Note: BASECLASS::DoLog() is protected. Therefore we cannot remember // a pointer to the old log target and send the message but we have // to subclass from wxLogGui and use its DoLog() function. wxLogGui::DoLog( nLevel, pszMessage, nTimestamp ); } }
wxLogLevel wxChainLogTextCtrl::m_nMaxLevel [protected] |
Definition at line 94 of file wxchainlogtextctrl.h.
Referenced by DoLog(), and wxChainLogTextCtrl().