/**
Creates the log frame window and starts collecting the messages in it.
- @param parent
+ @param pParent
The parent window for the log frame, may be @NULL
- @param title
+ @param szTitle
The title for the log frame
@param show
@true to show the frame initially (default), otherwise
logging them in the log frame (default), @false to only log them in the
log frame.
*/
- wxLogWindow(wxFrame parent, const wxChar title, bool show = true,
+ wxLogWindow(wxWindow* pParent, const wxString& szTitle, bool show = true,
bool passToOld = true);
/**
@see OnFrameDelete()
*/
- virtual bool OnFrameClose(wxFrame frame);
+ virtual bool OnFrameClose(wxFrame* frame);
/**
Called immediately after the log frame creation allowing for
any extra initializations.
*/
- virtual void OnFrameCreate(wxFrame frame);
+ virtual void OnFrameCreate(wxFrame* frame);
/**
Called right before the log frame is going to be deleted: will
always be called unlike OnFrameClose().
*/
- virtual void OnFrameDelete(wxFrame frame);
+ virtual void OnFrameDelete(wxFrame* frame);
/**
Shows or hides the frame.
Constructs a log target which sends all the log messages to the given
output stream. If it is @NULL, the messages are sent to @c cerr.
*/
- wxLogStream(std::ostream ostr = NULL);
+ wxLogStream(std::ostream *ostr = NULL);
};
@class wxLogStderr
This class can be used to redirect the log messages to a C file stream (not to
- be confused with C++ streams). It is the default log target for the non-GUI
- wxWidgets applications which send all the output to @c stderr.
+ be confused with C++ streams).
+
+ It is the default log target for the non-GUI wxWidgets applications which
+ send all the output to @c stderr.
@library{wxbase}
@category{logging}
The buffer can be cleared by Flush() which will also show the current
contents to the user.
*/
- const wxString GetBuffer();
+ const wxString& GetBuffer() const;
};
Otherwise, it is completely hidden behind the @e wxLogXXX() functions and
you may not even know about its existence.
+ @note For console-mode applications, the default target is wxLogStderr, so
+ that all @e wxLogXXX() functions print on @c stderr when @c wxUSE_GUI = 0.
+
@section log_derivingyours Deriving your own log target
standard @e strftime() function. For example, the default format is
"[%d/%b/%y %H:%M:%S] " which gives something like "[17/Sep/98 22:10:16] "
(without quotes) for the current date. Setting an empty string as the time
- format disables timestamping of the messages completely.
+ format or calling the shortcut wxLog::DisableTimestamp(), disables timestamping
+ of the messages completely.
See also
@li AddTraceMask()
@li SetRepetitionCounting()
@li GetRepetitionCounting()
- @note Timestamping is disabled for Visual C++ users in debug builds by
+ @note
+ Timestamping is disabled for Visual C++ users in debug builds by
default because otherwise it would be impossible to directly go to the line
from which the log message was generated by simply clicking in the debugger
window on the corresponding error message. If you wish to enable it, please
*/
static void ClearTraceMasks();
- /**
- Disables time stamping of the log messages.
-
- @since 2.9.0
- */
- static void SetTimestamp(const wxString& format);
-
- /**
- Called to process the message of the specified severity. @a msg is the text
- of the message as specified in the call of @e wxLogXXX() function which
- generated it and @a timestamp is the moment when the message was generated.
-
- The base class version prepends the timestamp to the message, adds a prefix
- corresponding to the log level and then calls
- DoLogString() with the resulting string.
- */
- virtual void DoLog(wxLogLevel level, const wxString& msg,
- time_t timestamp);
-
- /**
- Called to log the specified string. The timestamp is already included in the
- string but still passed to this function.
-
- A simple implementation may just send the string to @c stdout or, better,
- @c stderr.
- */
- virtual void DoLogString(const wxString& msg, time_t timestamp);
-
/**
Instructs wxLog to not create new log targets on the fly if there is none
currently. (Almost) for internal use only: it is supposed to be called by the
*/
static void SetTimestamp(const wxString& format);
+ /**
+ Disables time stamping of the log messages.
+
+ @since 2.9.0
+ */
+ static void DisableTimestamp();
+
/**
Sets the trace mask, see @ref log_derivingyours section for details.
*/
@see Resume(), wxLogNull
*/
static void Suspend();
+
+protected:
+
+ /**
+ Called to process the message of the specified severity. @a msg is the text
+ of the message as specified in the call of @e wxLogXXX() function which
+ generated it and @a timestamp is the moment when the message was generated.
+
+ The base class version prepends the timestamp to the message, adds a prefix
+ corresponding to the log level and then calls
+ DoLogString() with the resulting string.
+ */
+ virtual void DoLog(wxLogLevel level, const wxString& msg, time_t timestamp);
+
+ /**
+ Called to log the specified string. The timestamp is already included in the
+ string but still passed to this function.
+
+ A simple implementation may just send the string to @c stdout or, better,
+ @c stderr.
+ */
+ virtual void DoLogString(const wxString& msg, time_t timestamp);
};