Version: 3.3.0
wxLogWindow Class Reference

#include <wx/log.h>

+ Inheritance diagram for wxLogWindow:

Detailed Description

This class represents a background log window: to be precise, it collects all log messages in the log frame which it manages but also passes them on to the log target which was active at the moment of its creation.

This allows you, for example, to show all the log messages in a frame but still continue to process them normally by showing the standard log dialog.

Library:  wxCore
Category:  Logging
See also
wxLogTextCtrl

Public Member Functions

 wxLogWindow (wxWindow *pParent, const wxString &szTitle, bool show=true, bool passToOld=true)
 Creates the log frame window and starts collecting the messages in it. More...
 
wxFrameGetFrame () const
 Returns the associated log frame window. More...
 
virtual bool OnFrameClose (wxFrame *frame)
 Called if the user closes the window interactively, will not be called if it is destroyed for another reason (such as when program exits). More...
 
virtual void OnFrameDelete (wxFrame *frame)
 Called right before the log frame is going to be deleted: will always be called unlike OnFrameClose(). More...
 
void Show (bool show=true)
 Shows or hides the frame. More...
 
- Public Member Functions inherited from wxLogInterposer
 wxLogInterposer ()
 The default constructor installs this object as the current active log target. More...
 
- Public Member Functions inherited from wxLogChain
 wxLogChain (wxLog *logger)
 Sets the specified logger (which may be nullptr) as the default log target but the log messages are also passed to the previous log target if any. More...
 
virtual ~wxLogChain ()
 Destroys the previous log target. More...
 
void DetachOldLog ()
 Detaches the old log target so it won't be destroyed when the wxLogChain object is destroyed. More...
 
wxLogGetOldLog () const
 Returns the pointer to the previously active log target (which may be nullptr). More...
 
bool IsPassingMessages () const
 Returns true if the messages are passed to the previously active log target (default) or false if PassMessages() had been called. More...
 
void PassMessages (bool passMessages)
 By default, the log messages are passed to the previously active log target. More...
 
void SetLog (wxLog *logger)
 Sets another log target to use (may be nullptr). More...
 
- Public Member Functions inherited from wxLog
wxLogFormatterSetFormatter (wxLogFormatter *formatter)
 Sets the specified formatter as the active one. More...
 
virtual void Flush ()
 Show all pending output and clear the buffer. More...
 
void LogRecord (wxLogLevel level, const wxString &msg, const wxLogRecordInfo &info)
 Log the given record. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from wxLog
static void AddTraceMask (const wxString &mask)
 Add the mask to the list of allowed masks for wxLogTrace(). More...
 
static void ClearTraceMasks ()
 Removes all trace masks previously set with AddTraceMask(). More...
 
static const wxArrayStringGetTraceMasks ()
 Returns the currently allowed list of string trace masks. More...
 
static bool IsAllowedTraceMask (const wxString &mask)
 Returns true if the mask is one of allowed masks for wxLogTrace(). More...
 
static void RemoveTraceMask (const wxString &mask)
 Remove the mask from the list of allowed masks for wxLogTrace(). More...
 
static void DontCreateOnDemand ()
 Instructs wxLog to not create new log targets on the fly if there is none currently (see GetActiveTarget()). More...
 
static wxLogGetActiveTarget ()
 Returns the pointer to the active log target (may be nullptr). More...
 
static wxLogSetActiveTarget (wxLog *logtarget)
 Sets the specified log target as the active one. More...
 
static wxLogSetThreadActiveTarget (wxLog *logger)
 Sets a thread-specific log target. More...
 
static void FlushActive ()
 Flushes the current log target if any, does nothing if there is none. More...
 
static void Resume ()
 Resumes logging previously suspended by a call to Suspend(). More...
 
static void Suspend ()
 Suspends the logging until Resume() is called. More...
 
static wxLogLevel GetLogLevel ()
 Returns the current log level limit. More...
 
static bool IsLevelEnabled (wxLogLevel level, wxString component)
 Returns true if logging at this level is enabled for the current thread. More...
 
static void SetComponentLevel (const wxString &component, wxLogLevel level)
 Sets the log level for the given component. More...
 
static void SetLogLevel (wxLogLevel logLevel)
 Specifies that log messages with level greater (numerically) than logLevel should be ignored and not sent to the active log target. More...
 
static bool EnableLogging (bool enable=true)
 Globally enable or disable logging. More...
 
static bool IsEnabled ()
 Returns true if logging is enabled at all now. More...
 
static bool GetRepetitionCounting ()
 Returns whether the repetition counting mode is enabled. More...
 
static void SetRepetitionCounting (bool repetCounting=true)
 Enables logging mode in which a log message is logged once, and in case exactly the same message successively repeats one or more times, only the number of repetitions is logged. More...
 
static const wxStringGetTimestamp ()
 Returns the current timestamp format string. More...
 
static void SetTimestamp (const wxString &format)
 Sets the timestamp format prepended by the default log targets to all messages. More...
 
static void DisableTimestamp ()
 Disables time stamping of the log messages. More...
 
static bool GetVerbose ()
 Returns whether the verbose mode is currently active. More...
 
static void SetVerbose (bool verbose=true)
 Activates or deactivates verbose mode in which the verbose messages are logged as the normal ones instead of being silently dropped. More...
 
- Protected Member Functions inherited from wxLog
virtual void DoLogRecord (wxLogLevel level, const wxString &msg, const wxLogRecordInfo &info)
 Called to log a new record. More...
 
virtual void DoLogTextAtLevel (wxLogLevel level, const wxString &msg)
 Called to log the specified string at given level. More...
 
virtual void DoLogText (const wxString &msg)
 Called to log the specified string. More...
 

Constructor & Destructor Documentation

◆ wxLogWindow()

wxLogWindow::wxLogWindow ( wxWindow pParent,
const wxString szTitle,
bool  show = true,
bool  passToOld = true 
)

Creates the log frame window and starts collecting the messages in it.

Parameters
pParentThe parent window for the log frame, may be nullptr
szTitleThe title for the log frame
showtrue to show the frame initially (default), otherwise Show() must be called later.
passToOldtrue to process the log messages normally in addition to logging them in the log frame (default), false to only log them in the log frame. Note that if no targets were set using wxLog::SetActiveTarget() then wxLogWindow simply becomes the active one and messages won't be passed to other targets.

Member Function Documentation

◆ GetFrame()

wxFrame* wxLogWindow::GetFrame ( ) const

Returns the associated log frame window.

This may be used to position or resize it but use Show() to show or hide it.

◆ OnFrameClose()

virtual bool wxLogWindow::OnFrameClose ( wxFrame frame)
virtual

Called if the user closes the window interactively, will not be called if it is destroyed for another reason (such as when program exits).

Return true from here to allow the frame to close, false to prevent this from happening.

See also
OnFrameDelete()

◆ OnFrameDelete()

virtual void wxLogWindow::OnFrameDelete ( wxFrame frame)
virtual

Called right before the log frame is going to be deleted: will always be called unlike OnFrameClose().

◆ Show()

void wxLogWindow::Show ( bool  show = true)

Shows or hides the frame.