wx.Log

Inheritance diagram for wx.Log:



Description

wx.Log class defines the interface for the log targets used by wxWidgets logging functions.

The only situations when you need to directly use this class is when you want to derive your own log target because the existing ones don’t satisfy your needs. Another case is if you wish to customize the behaviour of the standard logging classes (all of which respect the wx.Log settings): for example, set which trace messages are logged and which are not or change (or even remove completely) the timestamp on the messages.

Otherwise, it is completely hidden behind the wx.LogXXX() functions and you may not even know about its existence.

Class API

Methods

__init__()
No docstrings available for this method.

AddTraceMask(mask)

Add the mask to the list of allowed masks for wx.LogTrace.

Parameters:

  • mask (string)

ClearTraceMasks()
Removes all trace masks previously set with AddTraceMask.

See also

RemoveTraceMask


Destroy()
No docstrings available for this method.

DontCreateOnDemand()

Instructs wx.Log 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 application shutdown code.

Note

Note that this function also calls ClearTraceMasks.


EnableLogging(doIt=True)

Parameters:

  • doIt (bool)

Returns:

bool


Flush()
Shows all the messages currently in buffer and clears it. If the buffer is already empty, nothing happens.

FlushActive()
Flushes the current log target if any, does nothing if there is none.

See also

Flush


GetActiveTarget()

Returns the pointer to the active log target (may be None).


Returns:

wx.Log


GetLogLevel()

Returns the current log level limit.


Returns:

int


GetRepetitionCounting()

Returns whether the repetition counting mode is enabled.


Returns:

bool


GetTimestamp()

Returns the current timestamp format string.


Returns:

string


GetTraceMasks()

Returns the currently allowed list of string trace masks.


Returns:

list of strings

See also

AddTraceMask.


GetVerbose()

Returns whether the verbose mode is currently active.


Returns:

bool


IsAllowedTraceMask(mask)

Returns True if the mask is one of allowed masks for wx.LogTrace.

Parameters:

  • mask (string)

Returns:

bool


IsEnabled()
No docstrings available for this method.

OnLog(level, message)

Forwards the message at specified level to the DoLog() function of the active log target if there is any, does nothing otherwise.

Parameters:

  • level (int)
  • message (string)

RemoveTraceMask(mask)

Remove the mask from the list of allowed masks for wx.LogTrace.

Parameters:

  • mask (string)

See also

AddTraceMask


Resume()
Resumes logging previously suspended by a call to Suspend. All messages logged in the meanwhile will be flushed soon.

SetActiveTarget(logtarget)

Sets the specified log target as the active one. Returns the pointer to the previous active log target (may be None). To suppress logging use a new instance of wx.LogNull not None. If the active log target is set to None a new default log target will be created when logging occurs.

Parameters:


Returns:

wx.Log


SetLogLevel(logLevel)

Specifies that log messages with level > logLevel should be ignored and not sent to the active log target.

Parameters:

  • logLevel (int)

SetRepetitionCounting(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.

Parameters:

  • repetCounting (bool)

SetTimestamp(format)

Sets the timestamp format prepended by the default log targets to all messages. The string may contain any normal characters as well as % prefixed format specificators, see strftime() manual for details. Passing a None value (not empty string) to this function disables message timestamping.

Parameters:

  • format (string)

SetTraceMask(mask)

Sets the trace mask

Parameters:

  • mask (string)

SetVerbose(verbose=True)

Activates or deactivates verbose mode in which the verbose messages are logged as the normal ones instead of being silently dropped.

Parameters:

  • verbose (bool)

Suspend()
Suspends the logging until Resume is called. Note that the latter must be called the same number of times as the former to undo it, i.e. if you call Suspend() twice you must call Resume() twice as well.

Note

Note that suspending the logging means that the log sink won’t be be flushed periodically, it doesn’t have any effect if the current log target does the logging immediately without waiting for Flush to be called (the standard GUI log target only shows the log dialog when it is flushed, so Suspend() works as expected with it).

See also

Resume, wx.LogNull


TimeStamp()
No docstrings available for this method.