]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/log.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxLog* classes
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
11 Different standard log levels (you may also define your own) used with
12 by standard wxLog functions wxLogGeneric(), wxLogError(), wxLogWarning(), etc...
16 wxLOG_FatalError
, //!< program can't continue, abort immediately
17 wxLOG_Error
, //!< a serious error, user must be informed about it
18 wxLOG_Warning
, //!< user is normally informed about it but may be ignored
19 wxLOG_Message
, //!< normal message (i.e. normal output of a non GUI app)
20 wxLOG_Status
, //!< informational: might go to the status line of GUI app
21 wxLOG_Info
, //!< informational message (a.k.a. 'Verbose')
22 wxLOG_Debug
, //!< never shown to the user, disabled in release mode
23 wxLOG_Trace
, //!< trace messages are also only enabled in debug mode
24 wxLOG_Progress
, //!< used for progress indicator (not yet)
25 wxLOG_User
= 100, //!< user defined levels start here
30 The type used to specify a log level.
32 Default values of ::wxLogLevel used by wxWidgets are contained in the
33 ::wxLogLevelValues enumeration.
35 typedef unsigned long wxLogLevel
;
38 Information about a log record (unit of the log output).
43 /// The name of the file where this log message was generated.
46 /// The line number at which this log message was generated.
50 The name of the function where the log record was generated.
52 This field may be @NULL if the compiler doesn't support @c __FUNCTION__
53 (but most modern compilers do).
57 /// Time when the log message was generated.
61 Id of the thread in which the message was generated.
63 This field is only available if wxWidgets was built with threads
64 support (<code>wxUSE_THREADS == 1</code>).
66 @see wxThread::GetCurrentId()
68 wxThreadIdType threadId
;
76 wxLogFormatter class is used to format the log messages. It implements the
77 default formatting and can be derived from to create custom formatters.
79 The default implementation formats the message into a string containing
80 the time stamp, level-dependent prefix and the message itself.
82 To change it, you can derive from it and override its Format() method. For
83 example, to include the thread id in the log messages you can use
85 class LogFormatterWithThread : public wxLogFormatter
87 virtual wxString Format(wxLogLevel level,
89 const wxLogRecordInfo& info) const
91 return wxString::Format("[%d] %s(%d) : %s",
92 info.threadId, info.filename, info.line, msg);
96 And then associate it with wxLog instance using its SetFormatter(). Then,
100 wxLogMessage(_("*** Application started ***"));
103 the log output could be something like:
106 [7872] d:\testApp\src\testApp.cpp(85) : *** Application started ***
112 @see @ref overview_log
120 The default ctor does nothing.
126 This function creates the full log message string.
128 Override it to customize the output string format.
131 The level of this log record, e.g. ::wxLOG_Error.
133 The log message itself.
135 All the other information (such as time, component, location...)
136 associated with this log record.
139 The formated message.
142 Time stamping is disabled for Visual C++ users in debug builds by
143 default because otherwise it would be impossible to directly go to the line
144 from which the log message was generated by simply clicking in the debugger
145 window on the corresponding error message. If you wish to enable it, override
148 virtual wxString
Format(wxLogLevel level
,
150 const wxLogRecordInfo
& info
) const;
154 This function formats the time stamp part of the log message.
156 Override this function if you need to customize just the time stamp.
162 The formated time string, may be empty.
164 virtual wxString
FormatTime(time_t time
) const;
171 wxLog class defines the interface for the <em>log targets</em> used by wxWidgets
172 logging functions as explained in the @ref overview_log.
174 The only situations when you need to directly use this class is when you want
175 to derive your own log target because the existing ones don't satisfy your
178 Otherwise, it is completely hidden behind the @ref group_funcmacro_log "wxLogXXX() functions"
179 and you may not even know about its existence.
181 @note For console-mode applications, the default target is wxLogStderr, so
182 that all @e wxLogXXX() functions print on @c stderr when @c wxUSE_GUI = 0.
187 @see @ref overview_log, @ref group_funcmacro_log "wxLogXXX() functions"
193 @name Trace mask functions
198 Add the @a mask to the list of allowed masks for wxLogTrace().
200 @see RemoveTraceMask(), GetTraceMasks()
202 static void AddTraceMask(const wxString
& mask
);
205 Removes all trace masks previously set with AddTraceMask().
207 @see RemoveTraceMask()
209 static void ClearTraceMasks();
212 Returns the currently allowed list of string trace masks.
216 static const wxArrayString
& GetTraceMasks();
219 Returns @true if the @a mask is one of allowed masks for wxLogTrace().
221 See also: AddTraceMask(), RemoveTraceMask()
223 static bool IsAllowedTraceMask(const wxString
& mask
);
226 Remove the @a mask from the list of allowed masks for
231 static void RemoveTraceMask(const wxString
& mask
);
238 @name Log target functions
243 Instructs wxLog to not create new log targets on the fly if there is none
244 currently (see GetActiveTarget()).
246 (Almost) for internal use only: it is supposed to be called by the
247 application shutdown code (where you don't want the log target to be
248 automatically created anymore).
250 Note that this function also calls ClearTraceMasks().
252 static void DontCreateOnDemand();
255 Returns the pointer to the active log target (may be @NULL).
257 Notice that if SetActiveTarget() hadn't been previously explicitly
258 called, this function will by default try to create a log target by
259 calling wxAppTraits::CreateLogTarget() which may be overridden in a
260 user-defined traits class to change the default behaviour. You may also
261 call DontCreateOnDemand() to disable this behaviour.
263 When this function is called from threads other than main one,
264 auto-creation doesn't happen. But if the thread has a thread-specific
265 log target previously set by SetThreadActiveTarget(), it is returned
266 instead of the global one. Otherwise, the global log target is
269 static wxLog
* GetActiveTarget();
272 Sets the specified log target as the active one.
274 Returns the pointer to the previous active log target (may be @NULL).
275 To suppress logging use a new instance of wxLogNull not @NULL. If the
276 active log target is set to @NULL a new default log target will be
277 created when logging occurs.
279 @see SetThreadActiveTarget()
281 static wxLog
* SetActiveTarget(wxLog
* logtarget
);
284 Sets a thread-specific log target.
286 The log target passed to this function will be used for all messages
287 logged by the current thread using the usual wxLog functions. This
288 shouldn't be called from the main thread which never uses a thread-
289 specific log target but can be used for the other threads to handle
290 thread logging completely separately; instead of buffering thread log
291 messages in the main thread logger.
293 Notice that unlike for SetActiveTarget(), wxWidgets does not destroy
294 the thread-specific log targets when the thread terminates so doing
295 this is your responsibility.
297 This method is only available if @c wxUSE_THREADS is 1, i.e. wxWidgets
298 was compiled with threads support.
301 The new thread-specific log target, possibly @NULL.
303 The previous thread-specific log target, initially @NULL.
307 static wxLog
*SetThreadActiveTarget(wxLog
*logger
);
310 Flushes the current log target if any, does nothing if there is none.
312 When this method is called from the main thread context, it also
313 flushes any previously buffered messages logged by the other threads.
314 When it is called from the other threads it simply calls Flush() on the
315 currently active log target, so it mostly makes sense to do this if a
316 thread has its own logger set with SetThreadActiveTarget().
318 static void FlushActive();
321 Resumes logging previously suspended by a call to Suspend().
322 All messages logged in the meanwhile will be flushed soon.
324 static void Resume();
327 Suspends the logging until Resume() is called.
329 Note that the latter must be called the same number of times as the former
330 to undo it, i.e. if you call Suspend() twice you must call Resume() twice as well.
332 Note that suspending the logging means that the log sink won't be flushed
333 periodically, it doesn't have any effect if the current log target does the
334 logging immediately without waiting for Flush() to be called (the standard
335 GUI log target only shows the log dialog when it is flushed, so Suspend()
336 works as expected with it).
338 @see Resume(), wxLogNull
340 static void Suspend();
347 @name Log level functions
352 Returns the current log level limit.
354 All messages at levels strictly greater than the value returned by this
355 function are not logged at all.
357 @see SetLogLevel(), IsLevelEnabled()
359 static wxLogLevel
GetLogLevel();
362 Returns true if logging at this level is enabled for the current thread.
364 This function only returns @true if logging is globally enabled and if
365 @a level is less than or equal to the maximal log level enabled for the
368 @see IsEnabled(), SetLogLevel(), GetLogLevel(), SetComponentLevel()
372 static bool IsLevelEnabled(wxLogLevel level
, wxString component
);
375 Sets the log level for the given component.
377 For example, to disable all but error messages from wxWidgets network
380 wxLog::SetComponentLevel("wx/net", wxLOG_Error);
383 SetLogLevel() may be used to set the global log level.
386 Non-empty component name, possibly using slashes (@c /) to separate
387 it into several parts.
389 Maximal level of log messages from this component which will be
390 handled instead of being simply discarded.
394 static void SetComponentLevel(const wxString
& component
, wxLogLevel level
);
397 Specifies that log messages with level greater (numerically) than
398 @a logLevel should be ignored and not sent to the active log target.
400 @see SetComponentLevel()
402 static void SetLogLevel(wxLogLevel logLevel
);
409 @name Enable/disable features functions
414 Globally enable or disable logging.
416 Calling this function with @false argument disables all log messages
417 for the current thread.
419 @see wxLogNull, IsEnabled()
422 The old state, i.e. @true if logging was previously enabled and
423 @false if it was disabled.
425 static bool EnableLogging(bool enable
= true);
428 Returns true if logging is enabled at all now.
430 @see IsLevelEnabled(), EnableLogging()
432 static bool IsEnabled();
435 Returns whether the repetition counting mode is enabled.
437 static bool GetRepetitionCounting();
440 Enables logging mode in which a log message is logged once, and in case exactly
441 the same message successively repeats one or more times, only the number of
442 repetitions is logged.
444 static void SetRepetitionCounting(bool repetCounting
= true);
447 Returns the current timestamp format string.
449 Notice that the current time stamp is only used by the default log
450 formatter and custom formatters may ignore this format.
452 static const wxString
& GetTimestamp();
455 Sets the timestamp format prepended by the default log targets to all
456 messages. The string may contain any normal characters as well as %
457 prefixed format specifiers, see @e strftime() manual for details.
458 Passing an empty string to this function disables message time stamping.
460 Notice that the current time stamp is only used by the default log
461 formatter and custom formatters may ignore this format. You can also
462 define a custom wxLogFormatter to customize the time stamp handling
463 beyond changing its format.
465 static void SetTimestamp(const wxString
& format
);
468 Disables time stamping of the log messages.
470 Notice that the current time stamp is only used by the default log
471 formatter and custom formatters may ignore calls to this function.
475 static void DisableTimestamp();
478 Returns whether the verbose mode is currently active.
480 static bool GetVerbose();
483 Activates or deactivates verbose mode in which the verbose messages are
484 logged as the normal ones instead of being silently dropped.
486 The verbose messages are the trace messages which are not disabled in the
487 release mode and are generated by wxLogVerbose().
489 @see @ref overview_log
491 static void SetVerbose(bool verbose
= true);
497 Sets the specified formatter as the active one.
500 The new formatter. If @NULL, reset to the default formatter.
502 Returns the pointer to the previous formatter. You must delete it
503 if you don't plan to attach it again to a wxLog object later.
507 wxLogFormatter
*SetFormatter(wxLogFormatter
* formatter
);
511 Some of wxLog implementations, most notably the standard wxLogGui class,
512 buffer the messages (for example, to avoid showing the user a zillion of modal
513 message boxes one after another -- which would be really annoying).
514 This function shows them all and clears the buffer contents.
515 If the buffer is already empty, nothing happens.
517 If you override this method in a derived class, call the base class
518 version first, before doing anything else.
520 virtual void Flush();
523 Log the given record.
525 This function should only be called from the DoLog() implementations in
526 the derived classes if they need to call DoLogRecord() on another log
527 object (they can, of course, just use wxLog::DoLogRecord() call syntax
528 to call it on the object itself). It should not be used for logging new
529 messages which can be only sent to the currently active logger using
530 OnLog() which also checks if the logging (for this level) is enabled
531 while this method just directly calls DoLog().
533 Example of use of this class from wxLogChain:
535 void wxLogChain::DoLogRecord(wxLogLevel level,
537 const wxLogRecordInfo& info)
539 // let the previous logger show it
540 if ( m_logOld && IsPassingMessages() )
541 m_logOld->LogRecord(level, msg, info);
543 // and also send it to the new one
544 if ( m_logNew && m_logNew != this )
545 m_logNew->LogRecord(level, msg, info);
551 void LogRecord(wxLogLevel level
, const wxString
& msg
, const wxLogRecordInfo
& info
);
555 @name Logging callbacks.
557 The functions which should be overridden by custom log targets.
559 When defining a new log target, you have a choice between overriding
560 DoLogRecord(), which provides maximal flexibility, DoLogTextAtLevel()
561 which can be used if you don't intend to change the default log
562 messages formatting but want to handle log messages of different levels
563 differently or, in the simplest case, DoLogText().
568 Called to log a new record.
570 Any log message created by wxLogXXX() functions is passed to this
571 method of the active log target. The default implementation prepends
572 the timestamp and, for some log levels (e.g. error and warning), the
573 corresponding prefix to @a msg and passes it to DoLogTextAtLevel().
575 You may override this method to implement custom formatting of the
576 log messages or to implement custom filtering of log messages (e.g. you
577 could discard all log messages coming from the given source file).
579 virtual void DoLogRecord(wxLogLevel level
,
581 const wxLogRecordInfo
& info
);
584 Called to log the specified string at given level.
586 The base class versions logs debug and trace messages on the system
587 default debug output channel and passes all the other messages to
590 virtual void DoLogTextAtLevel(wxLogLevel level
, const wxString
& msg
);
593 Called to log the specified string.
595 A simple implementation might just send the string to @c stdout or
596 @c stderr or save it in a file (of course, the already existing
597 wxLogStderr can be used for this).
599 The base class version of this function asserts so it must be
600 overridden if you don't override DoLogRecord() or DoLogTextAtLevel().
602 virtual void DoLogText(const wxString
& msg
);
612 This simple class allows you to chain log sinks, that is to install a new sink but
613 keep passing log messages to the old one instead of replacing it completely as
614 wxLog::SetActiveTarget does.
616 It is especially useful when you want to divert the logs somewhere (for
617 example to a file or a log window) but also keep showing the error messages
618 using the standard dialogs as wxLogGui does by default.
623 wxLogChain *logChain = new wxLogChain(new wxLogStderr);
625 // all the log messages are sent to stderr and also processed as usually
628 // don't delete logChain directly as this would leave a dangling
629 // pointer as active log target, use SetActiveTarget() instead
630 delete wxLog::SetActiveTarget(...something else or NULL...);
636 class wxLogChain
: public wxLog
640 Sets the specified @c logger (which may be @NULL) as the default log
641 target but the log messages are also passed to the previous log target if any.
643 wxLogChain(wxLog
* logger
);
646 Destroys the previous log target.
648 virtual ~wxLogChain();
651 Detaches the old log target so it won't be destroyed when the wxLogChain object
657 Returns the pointer to the previously active log target (which may be @NULL).
659 wxLog
* GetOldLog() const;
662 Returns @true if the messages are passed to the previously active log
663 target (default) or @false if PassMessages() had been called.
665 bool IsPassingMessages() const;
668 By default, the log messages are passed to the previously active log target.
669 Calling this function with @false parameter disables this behaviour
670 (presumably temporarily, as you shouldn't use wxLogChain at all otherwise) and
671 it can be reenabled by calling it again with @a passMessages set to @true.
673 void PassMessages(bool passMessages
);
676 Sets another log target to use (may be @NULL).
678 The log target specified in the wxLogChain(wxLog*) constructor or in a
679 previous call to this function is deleted.
680 This doesn't change the old log target value (the one the messages are
681 forwarded to) which still remains the same as was active when wxLogChain
684 void SetLog(wxLog
* logger
);
690 @class wxLogInterposerTemp
692 A special version of wxLogChain which uses itself as the new log target.
693 It forwards log messages to the previously installed one in addition to
694 processing them itself. Unlike wxLogInterposer, it doesn't delete the old
695 target which means it can be used to temporarily redirect log output.
697 As per wxLogInterposer, this class must be derived from to implement
698 wxLog::DoLog and/or wxLog::DoLogString methods.
703 class wxLogInterposerTemp
: public wxLogChain
707 The default constructor installs this object as the current active log target.
709 wxLogInterposerTemp();
717 This class can be used to redirect the log messages to a C++ stream.
719 Please note that this class is only available if wxWidgets was compiled with
720 the standard iostream library support (@c wxUSE_STD_IOSTREAM must be on).
725 @see wxLogStderr, wxStreamToTextRedirector
727 class wxLogStream
: public wxLog
731 Constructs a log target which sends all the log messages to the given
732 output stream. If it is @NULL, the messages are sent to @c cerr.
734 wxLogStream(std::ostream
*ostr
= NULL
);
742 This class can be used to redirect the log messages to a C file stream (not to
743 be confused with C++ streams).
745 It is the default log target for the non-GUI wxWidgets applications which
746 send all the output to @c stderr.
753 class wxLogStderr
: public wxLog
757 Constructs a log target which sends all the log messages to the given
758 @c FILE. If it is @NULL, the messages are sent to @c stderr.
760 wxLogStderr(FILE* fp
= NULL
);
768 wxLogBuffer is a very simple implementation of log sink which simply collects
769 all the logged messages in a string (except the debug messages which are output
770 in the usual way immediately as we're presumably not interested in collecting
771 them for later). The messages from different log function calls are separated
774 All the messages collected so far can be shown to the user (and the current
775 buffer cleared) by calling the overloaded wxLogBuffer::Flush method.
780 class wxLogBuffer
: public wxLog
784 The default ctor does nothing.
789 Shows all the messages collected so far to the user (using a message box in the
790 GUI applications or by printing them out to the console in text mode) and
791 clears the internal buffer.
793 virtual void Flush();
796 Returns the current buffer contains. Messages from different log function calls
797 are separated with the new lines in the buffer.
798 The buffer can be cleared by Flush() which will also show the current
799 contents to the user.
801 const wxString
& GetBuffer() const;
807 @class wxLogInterposer
809 A special version of wxLogChain which uses itself as the new log target.
810 It forwards log messages to the previously installed one in addition to
811 processing them itself.
813 Unlike wxLogChain which is usually used directly as is, this class must be
814 derived from to implement wxLog::DoLog and/or wxLog::DoLogString methods.
816 wxLogInterposer destroys the previous log target in its destructor.
817 If you don't want this to happen, use wxLogInterposerTemp instead.
822 class wxLogInterposer
: public wxLogChain
826 The default constructor installs this object as the current active log target.
836 This class allows you to temporarily suspend logging. All calls to the log
837 functions during the life time of an object of this class are just ignored.
839 In particular, it can be used to suppress the log messages given by wxWidgets
840 itself but it should be noted that it is rarely the best way to cope with this
841 problem as @b all log messages are suppressed, even if they indicate a
842 completely different error than the one the programmer wanted to suppress.
844 For instance, the example of the overview:
849 // wxFile.Open() normally complains if file can't be opened, we don't want it
852 if ( !file.Open("bar") )
853 ... process error ourselves ...
854 } // ~wxLogNull called, old log sink restored
856 wxLogMessage("..."); // ok
859 would be better written as:
864 // don't try to open file if it doesn't exist, we are prepared to deal with
865 // this ourselves - but all other errors are not expected
866 if ( wxFile::Exists("bar") )
868 // gives an error message if the file couldn't be opened
897 // ============================================================================
898 // Global functions/macros
899 // ============================================================================
901 /** @addtogroup group_funcmacro_log */
905 This function shows a message to the user in a safe way and should be safe
906 to call even before the application has been initialized or if it is
907 currently in some other strange state (for example, about to crash). Under
908 Windows this function shows a message box using a native dialog instead of
909 wxMessageBox() (which might be unsafe to call), elsewhere it simply prints
910 the message to the standard output using the title as prefix.
913 The title of the message box shown to the user or the prefix of the
916 The text to show to the user.
918 @see wxLogFatalError()
922 void wxSafeShowMessage(const wxString
& title
, const wxString
& text
);
925 Returns the error code from the last system call. This function uses
926 @c errno on Unix platforms and @c GetLastError under Win32.
928 @see wxSysErrorMsg(), wxLogSysError()
932 unsigned long wxSysErrorCode();
935 Returns the error message corresponding to the given system error code. If
936 @a errCode is 0 (default), the last error code (as returned by
937 wxSysErrorCode()) is used.
939 @see wxSysErrorCode(), wxLogSysError()
943 const wxChar
* wxSysErrorMsg(unsigned long errCode
= 0);
947 /** @addtogroup group_funcmacro_log */
950 Logs a message with the given wxLogLevel.
951 E.g. using @c wxLOG_Message as first argument, this function behaves like wxLogMessage().
955 void wxLogGeneric(wxLogLevel level
, const char* formatString
, ... );
956 void wxVLogGeneric(wxLogLevel level
, const char* formatString
, va_list argPtr
);
959 /** @addtogroup group_funcmacro_log */
962 For all normal, informational messages. They also appear in a message box
963 by default (but it can be changed).
967 void wxLogMessage(const char* formatString
, ... );
968 void wxVLogMessage(const char* formatString
, va_list argPtr
);
971 /** @addtogroup group_funcmacro_log */
974 For verbose output. Normally, it is suppressed, but might be activated if
975 the user wishes to know more details about the program progress (another,
976 but possibly confusing name for the same function could be @c wxLogInfo).
980 void wxLogVerbose(const char* formatString
, ... );
981 void wxVLogVerbose(const char* formatString
, va_list argPtr
);
984 /** @addtogroup group_funcmacro_log */
987 For warnings - they are also normally shown to the user, but don't
988 interrupt the program work.
992 void wxLogWarning(const char* formatString
, ... );
993 void wxVLogWarning(const char* formatString
, va_list argPtr
);
996 /** @addtogroup group_funcmacro_log */
999 Like wxLogError(), but also terminates the program with the exit code 3.
1000 Using @e abort() standard function also terminates the program with this
1005 void wxLogFatalError(const char* formatString
, ... );
1006 void wxVLogFatalError(const char* formatString
, va_list argPtr
);
1009 /** @addtogroup group_funcmacro_log */
1012 The functions to use for error messages, i.e. the messages that must be
1013 shown to the user. The default processing is to pop up a message box to
1014 inform the user about it.
1018 void wxLogError(const char* formatString
, ... );
1019 void wxVLogError(const char* formatString
, va_list argPtr
);
1022 /** @addtogroup group_funcmacro_log */
1025 Log a message at @c wxLOG_Trace log level (see ::wxLogLevelValues enum).
1027 Notice that the use of trace masks is not recommended any more as setting
1028 the log components (please see @ref overview_log_enable) provides a way to
1029 do the same thing for log messages of any level, and not just the tracing
1032 Like wxLogDebug(), trace functions only do something in debug builds and
1033 expand to nothing in the release one. The reason for making it a separate
1034 function is that usually there are a lot of trace messages, so it might
1035 make sense to separate them from other debug messages.
1037 Trace messages can be separated into different categories; these functions in facts
1038 only log the message if the given @a mask is currently enabled in wxLog.
1039 This lets you selectively trace only some operations and not others by enabling the
1040 desired trace masks with wxLog::AddTraceMask() or by setting the
1041 @ref overview_envvars "@c WXTRACE environment variable".
1043 The predefined string trace masks used by wxWidgets are:
1046 @itemdef{ wxTRACE_MemAlloc, Trace memory allocation (new/delete) }
1047 @itemdef{ wxTRACE_Messages, Trace window messages/X callbacks }
1048 @itemdef{ wxTRACE_ResAlloc, Trace GDI resource allocation }
1049 @itemdef{ wxTRACE_RefCount, Trace various ref counting operations }
1050 @itemdef{ wxTRACE_OleCalls, Trace OLE method calls (Win32 only) }
1055 void wxLogTrace(const char* mask
, const char* formatString
, ... );
1056 void wxVLogTrace(const char* mask
, const char* formatString
, va_list argPtr
);
1059 /** @addtogroup group_funcmacro_log */
1062 Like wxLogDebug(), trace functions only do something in debug builds and
1063 expand to nothing in the release one. The reason for making it a separate
1064 function is that usually there are a lot of trace messages, so it might
1065 make sense to separate them from other debug messages.
1068 This version of wxLogTrace() only logs the message if all the bits
1069 corresponding to the @a mask are set in the wxLog trace mask which can be
1070 set by calling wxLog::SetTraceMask(). This version is less flexible than
1071 wxLogTrace(const char*,const char*,...) because it doesn't allow defining
1072 the user trace masks easily. This is why it is deprecated in favour of
1073 using string trace masks.
1075 The following bitmasks are defined for wxTraceMask:
1078 @itemdef{ wxTraceMemAlloc, Trace memory allocation (new/delete) }
1079 @itemdef{ wxTraceMessages, Trace window messages/X callbacks }
1080 @itemdef{ wxTraceResAlloc, Trace GDI resource allocation }
1081 @itemdef{ wxTraceRefCount, Trace various ref counting operations }
1082 @itemdef{ wxTraceOleCalls, Trace OLE method calls (Win32 only) }
1087 void wxLogTrace(wxTraceMask mask
, const char* formatString
, ... );
1088 void wxVLogTrace(wxTraceMask mask
, const char* formatString
, va_list argPtr
);
1091 /** @addtogroup group_funcmacro_log */
1094 The right functions for debug output. They only do something in debug mode
1095 (when the preprocessor symbol @c __WXDEBUG__ is defined) and expand to
1096 nothing in release mode (otherwise).
1100 void wxLogDebug(const char* formatString
, ... );
1101 void wxVLogDebug(const char* formatString
, va_list argPtr
);
1104 /** @addtogroup group_funcmacro_log */
1107 Messages logged by this function will appear in the statusbar of the
1108 @a frame or of the top level application window by default (i.e. when using
1109 the second version of the functions).
1111 If the target frame doesn't have a statusbar, the message will be lost.
1115 void wxLogStatus(wxFrame
* frame
, const char* formatString
, ... );
1116 void wxVLogStatus(wxFrame
* frame
, const char* formatString
, va_list argPtr
);
1117 void wxLogStatus(const char* formatString
, ... );
1118 void wxVLogStatus(const char* formatString
, va_list argPtr
);
1121 /** @addtogroup group_funcmacro_log */
1124 Mostly used by wxWidgets itself, but might be handy for logging errors
1125 after system call (API function) failure. It logs the specified message
1126 text as well as the last system error code (@e errno or @e GetLastError()
1127 depending on the platform) and the corresponding error message. The second
1128 form of this function takes the error code explicitly as the first
1131 @see wxSysErrorCode(), wxSysErrorMsg()
1135 void wxLogSysError(const char* formatString
, ... );
1136 void wxVLogSysError(const char* formatString
, va_list argPtr
);
1139 /** @addtogroup group_funcmacro_debug */
1143 @def wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
1145 Use this macro to disable logging at debug and trace levels in release
1146 build when not using wxIMPLEMENT_APP().
1148 @see wxDISABLE_DEBUG_SUPPORT(),
1149 wxDISABLE_ASSERTS_IN_RELEASE_BUILD(),
1150 @ref overview_debugging
1156 #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()