wxIScan
wxChainLogTextCtrl Class Reference

A class to split the log output into a wxLogGui and a wxTextCtrl target. More...

#include <wxchainlogtextctrl.h>

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

wxChainLogTextCtrl::wxChainLogTextCtrl ( wxTextCtrl *  poTextctrl,
wxLogLevel  nMaxLevel = 2 
) [inline]

Standard constructor.

Parameters:
poTextctrlA pointer to a wxTextCtrl object, that is used as an addition
nMaxLevelRefence 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 ) );
    }

Member Function Documentation

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.

Parameters:
oLevelLog level
pszMessageMessage to log
nTimestampTimestamp 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 );
        }
    }

Member Data Documentation

wxLogLevel wxChainLogTextCtrl::m_nMaxLevel [protected]

Definition at line 94 of file wxchainlogtextctrl.h.

Referenced by DoLog(), and wxChainLogTextCtrl().


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