Version: 3.1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

Detailed Description

These functions provide a variety of logging functions.

The functions use (implicitly) the currently active log target, so their descriptions here may not apply if the log target is not the standard one (installed by wxWidgets in the beginning of the program).

Related Overviews: Logging Overview

Related class group: Logging

Macros

#define WXTRACE(format,...)
 
#define WXTRACELEVEL(level, format,...)
 

Functions

void wxSafeShowMessage (const wxString &title, const wxString &text)
 This function shows a message to the user in a safe way and should be safe to call even before the application has been initialized or if it is currently in some other strange state (for example, about to crash). More...
 
unsigned long wxSysErrorCode ()
 Returns the error code from the last system call. More...
 
const wxCharwxSysErrorMsg (unsigned long errCode=0)
 Returns the error message corresponding to the given system error code. More...
 
void wxLogGeneric (wxLogLevel level, const char *formatString,...)
 Logs a message with the given wxLogLevel. More...
 
void wxVLogGeneric (wxLogLevel level, const char *formatString, va_list argPtr)
 
void wxLogMessage (const char *formatString,...)
 For all normal, informational messages. More...
 
void wxVLogMessage (const char *formatString, va_list argPtr)
 
void wxLogVerbose (const char *formatString,...)
 For verbose output. More...
 
void wxVLogVerbose (const char *formatString, va_list argPtr)
 
void wxLogWarning (const char *formatString,...)
 For warnings - they are also normally shown to the user, but don't interrupt the program work. More...
 
void wxVLogWarning (const char *formatString, va_list argPtr)
 
void wxLogFatalError (const char *formatString,...)
 Like wxLogError(), but also terminates the program with the exit code 3. More...
 
void wxVLogFatalError (const char *formatString, va_list argPtr)
 
void wxLogError (const char *formatString,...)
 The functions to use for error messages, i.e. More...
 
void wxVLogError (const char *formatString, va_list argPtr)
 
void wxLogTrace (const char *mask, const char *formatString,...)
 Log a message at wxLOG_Trace log level (see wxLogLevelValues enum). More...
 
void wxVLogTrace (const char *mask, const char *formatString, va_list argPtr)
 
void wxLogTrace (wxTraceMask mask, const char *formatString,...)
 Like wxLogDebug(), trace functions only do something in debug builds and expand to nothing in the release one. More...
 
void wxVLogTrace (wxTraceMask mask, const char *formatString, va_list argPtr)
 
void wxLogDebug (const char *formatString,...)
 The right functions for debug output. More...
 
void wxVLogDebug (const char *formatString, va_list argPtr)
 
void wxLogStatus (wxFrame *frame, const char *formatString,...)
 Messages logged by this function will appear in the statusbar of the frame or of the top level application window by default (i.e. More...
 
void wxVLogStatus (wxFrame *frame, const char *formatString, va_list argPtr)
 
void wxLogStatus (const char *formatString,...)
 
void wxVLogStatus (const char *formatString, va_list argPtr)
 
void wxLogSysError (const char *formatString,...)
 Mostly used by wxWidgets itself, but might be handy for logging errors after system call (API function) failure. More...
 
void wxVLogSysError (const char *formatString, va_list argPtr)
 
void wxTrace (const wxString &format,...)
 
void wxTraceLevel (int level, const wxString &format,...)
 

Macro Definition Documentation

#define WXTRACE (   format,
  ... 
)
Deprecated:
Use one of the wxLogTrace() functions or one of the wxVLogTrace() functions instead.

Calls wxTrace() with printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext).

Include file:

#include <wx/memory.h> 
#define WXTRACELEVEL (   level,
  format,
  ... 
)
Deprecated:
Use one of the wxLogTrace() functions or one of the wxVLogTrace() functions instead.

Calls wxTraceLevel with printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext). The first argument should be the level at which this information is appropriate. It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than this value.

Include file:

#include <wx/memory.h> 

Function Documentation

void wxLogDebug ( const char *  formatString,
  ... 
)

The right functions for debug output.

They only do something in debug mode (when the preprocessor symbol WXDEBUG is defined) and expand to nothing in release mode (otherwise).

Include file:

#include <wx/log.h> 
void wxLogError ( const char *  formatString,
  ... 
)

The functions to use for error messages, i.e.

the messages that must be shown to the user. The default processing is to pop up a message box to inform the user about it.

Include file:

#include <wx/log.h> 
void wxLogFatalError ( const char *  formatString,
  ... 
)

Like wxLogError(), but also terminates the program with the exit code 3.

Using abort() standard function also terminates the program with this exit code.

Include file:

#include <wx/log.h> 
void wxLogGeneric ( wxLogLevel  level,
const char *  formatString,
  ... 
)

Logs a message with the given wxLogLevel.

E.g. using wxLOG_Message as first argument, this function behaves like wxLogMessage().

Include file:

#include <wx/log.h> 
void wxLogMessage ( const char *  formatString,
  ... 
)

For all normal, informational messages.

They also appear in a message box by default (but it can be changed).

Include file:

#include <wx/log.h> 
void wxLogStatus ( wxFrame frame,
const char *  formatString,
  ... 
)

Messages logged by this function will appear in the statusbar of the frame or of the top level application window by default (i.e.

when using the second version of the functions).

If the target frame doesn't have a statusbar, the message will be lost.

Include file:

#include <wx/log.h> 
void wxLogStatus ( const char *  formatString,
  ... 
)
void wxLogSysError ( const char *  formatString,
  ... 
)

Mostly used by wxWidgets itself, but might be handy for logging errors after system call (API function) failure.

It logs the specified message text as well as the last system error code (errno or GetLastError() depending on the platform) and the corresponding error message. The second form of this function takes the error code explicitly as the first argument.

See also
wxSysErrorCode(), wxSysErrorMsg()

Include file:

#include <wx/log.h> 
void wxLogTrace ( const char *  mask,
const char *  formatString,
  ... 
)

Log a message at wxLOG_Trace log level (see wxLogLevelValues enum).

Notice that the use of trace masks is not recommended any more as setting the log components (please see Log Messages Selection) provides a way to do the same thing for log messages of any level, and not just the tracing ones.

Like wxLogDebug(), trace functions only do something in debug builds and expand to nothing in the release one. The reason for making it a separate function is that usually there are a lot of trace messages, so it might make sense to separate them from other debug messages.

Trace messages can be separated into different categories; these functions in facts only log the message if the given mask is currently enabled in wxLog. This lets you selectively trace only some operations and not others by enabling the desired trace masks with wxLog::AddTraceMask() or by setting the WXTRACE environment variable.

The predefined string trace masks used by wxWidgets are:

wxTRACE_MemAlloc Trace memory allocation (new/delete)
wxTRACE_Messages Trace window messages/X callbacks
wxTRACE_ResAlloc Trace GDI resource allocation
wxTRACE_RefCount Trace various ref counting operations
wxTRACE_OleCalls Trace OLE method calls (Win32 only)

Include file:

#include <wx/log.h> 
void wxLogTrace ( wxTraceMask  mask,
const char *  formatString,
  ... 
)

Like wxLogDebug(), trace functions only do something in debug builds and expand to nothing in the release one.

The reason for making it a separate function is that usually there are a lot of trace messages, so it might make sense to separate them from other debug messages.

Deprecated:
This version of wxLogTrace() only logs the message if all the bits corresponding to the mask are set in the wxLog trace mask which can be set by calling wxLog::SetTraceMask(). This version is less flexible than wxLogTrace(const char*,const char*,...) because it doesn't allow defining the user trace masks easily. This is why it is deprecated in favour of using string trace masks.

The following bitmasks are defined for wxTraceMask:

wxTraceMemAlloc Trace memory allocation (new/delete)
wxTraceMessages Trace window messages/X callbacks
wxTraceResAlloc Trace GDI resource allocation
wxTraceRefCount Trace various ref counting operations
wxTraceOleCalls Trace OLE method calls (Win32 only)

Include file:

#include <wx/log.h> 
void wxLogVerbose ( const char *  formatString,
  ... 
)

For verbose output.

Normally, it is suppressed, but might be activated if the user wishes to know more details about the program progress (another, but possibly confusing name for the same function could be wxLogInfo).

Include file:

#include <wx/log.h> 
void wxLogWarning ( const char *  formatString,
  ... 
)

For warnings - they are also normally shown to the user, but don't interrupt the program work.

Include file:

#include <wx/log.h> 
void wxSafeShowMessage ( const wxString title,
const wxString text 
)

This function shows a message to the user in a safe way and should be safe to call even before the application has been initialized or if it is currently in some other strange state (for example, about to crash).

Under Windows this function shows a message box using a native dialog instead of wxMessageBox() (which might be unsafe to call), elsewhere it simply prints the message to the standard output using the title as prefix.

Parameters
titleThe title of the message box shown to the user or the prefix of the message string.
textThe text to show to the user.
See also
wxLogFatalError()

Include file:

#include <wx/log.h> 
unsigned long wxSysErrorCode ( )

Returns the error code from the last system call.

This function uses errno on Unix platforms and GetLastError under Win32.

See also
wxSysErrorMsg(), wxLogSysError()

Include file:

#include <wx/log.h> 
const wxChar* wxSysErrorMsg ( unsigned long  errCode = 0)

Returns the error message corresponding to the given system error code.

If errCode is 0 (default), the last error code (as returned by wxSysErrorCode()) is used.

See also
wxSysErrorCode(), wxLogSysError()

Include file:

#include <wx/log.h> 
void wxTrace ( const wxString format,
  ... 
)
Deprecated:
Use one of the wxLogTrace() functions or one of the wxVLogTrace() functions instead.

Takes printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext).

Include file:

#include <wx/memory.h> 
void wxTraceLevel ( int  level,
const wxString format,
  ... 
)
Deprecated:
Use one of the wxLogTrace() functions or one of the wxVLogTrace() functions instead.

Takes printf() style variable argument syntax. Output is directed to the current output stream (see wxDebugContext). The first argument should be the level at which this information is appropriate. It will only be output if the level returned by wxDebugContext::GetLevel() is equal to or greater than this value.

Include file:

#include <wx/memory.h> 
void wxVLogDebug ( const char *  formatString,
va_list  argPtr 
)
void wxVLogError ( const char *  formatString,
va_list  argPtr 
)
void wxVLogFatalError ( const char *  formatString,
va_list  argPtr 
)
void wxVLogGeneric ( wxLogLevel  level,
const char *  formatString,
va_list  argPtr 
)
void wxVLogMessage ( const char *  formatString,
va_list  argPtr 
)
void wxVLogStatus ( wxFrame frame,
const char *  formatString,
va_list  argPtr 
)
void wxVLogStatus ( const char *  formatString,
va_list  argPtr 
)
void wxVLogSysError ( const char *  formatString,
va_list  argPtr 
)
void wxVLogTrace ( const char *  mask,
const char *  formatString,
va_list  argPtr 
)
void wxVLogTrace ( wxTraceMask  mask,
const char *  formatString,
va_list  argPtr 
)
void wxVLogVerbose ( const char *  formatString,
va_list  argPtr 
)
void wxVLogWarning ( const char *  formatString,
va_list  argPtr 
)