Add information about the log message generation location to wxLog.
This means that wxLog::DoLogRecord() can now retrieve the file name, line number and the function where the message was logged. An unfortunate consequence of this change is that now if ( condition ) wxLogError("Whatever"); results in a warning from g++ 4.x with -Wparentehses, so extra parentheses had to be added in many places. Finally, also allow storing arbitrary attributes in wxLogRecordInfo. This had to be added to implement our own overloaded wxLogStatus() and wxLogSysError() and will probably be useful for the others as well. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -71,10 +71,12 @@ argument list pointer. Here are all of them:
|
||||
as the first argument.
|
||||
@li wxLogDebug is @b the right function for debug output. It only does anything
|
||||
at all in the debug mode (when the preprocessor symbol __WXDEBUG__ is
|
||||
defined) and expands to nothing in release mode (otherwise). @b Tip: under
|
||||
Windows, you must either run the program under debugger or use a 3rd party
|
||||
program such as DebugView to actually see the debug output.
|
||||
- DebugView: http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx
|
||||
defined) and expands to nothing in release mode (otherwise).
|
||||
|
||||
@b Tip: under Windows, you must either run the program under debugger or
|
||||
use a 3rd party program such as DebugView
|
||||
(http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx)
|
||||
to actually see the debug output.
|
||||
@li wxLogTrace as wxLogDebug only does something in debug build. The reason for
|
||||
making it a separate function from it is that usually there are a lot of
|
||||
trace messages, so it might make sense to separate them from other debug
|
||||
@@ -133,12 +135,16 @@ the active target with a call to @e SetActiveTarget() and it will be used
|
||||
automatically by all subsequent calls to @e wxLogXXX() functions.
|
||||
|
||||
To create a new log target class you only need to derive it from wxLog and
|
||||
implement one (or both) of @e DoLog() and @e DoLogString() in it. The second
|
||||
one is enough if you're happy with the standard wxLog message formatting
|
||||
(prepending "Error:" or "Warning:", timestamping @&c) but just want to send
|
||||
the messages somewhere else. The first one may be overridden to do whatever
|
||||
you want but you have to distinguish between the different message types
|
||||
yourself.
|
||||
override one or several of wxLog::DoLogRecord(), wxLog::DoLogTextAtLevel() and
|
||||
wxLog::DoLogText() in it. The first one is the most flexible and allows you to
|
||||
change the formatting of the messages, dynamically filter and redirect them and
|
||||
so on -- all log messages, except for those generated by wxLogFatalError(),
|
||||
pass by this function. wxLog::DoLogTextAtLevel() should be overridden if you
|
||||
simply want to redirect the log messages somewhere else, without changing their
|
||||
formatting. Finally, it is enough to override wxLog::DoLogText() if you only
|
||||
want to redirect the log messages and the destination doesn't depend on the
|
||||
message log level.
|
||||
|
||||
|
||||
There are some predefined classes deriving from wxLog and which might be
|
||||
helpful to see how you can create a new log target class and, of course, may
|
||||
|
Reference in New Issue
Block a user