****** wx.Log ****** Inheritance diagram for `wx.Log`: | .. inheritance-diagram:: 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. Known Subclasses ^^^^^^^^^^^^^^^^ `wx.LogBuffer`, `wx.LogChain `_, `wx.LogGui `_, `wx.LogStderr `_, `wx.LogTextCtrl `_, `wx.LogWindow `_, `wx.PyLog `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddTraceMask <#AddTraceMask>`_ * `ClearTraceMasks <#ClearTraceMasks>`_ * `Destroy <#Destroy>`_ * `DontCreateOnDemand <#DontCreateOnDemand>`_ * `EnableLogging <#EnableLogging>`_ * `Flush <#Flush>`_ * `FlushActive <#FlushActive>`_ * `GetActiveTarget <#GetActiveTarget>`_ * `GetLogLevel <#GetLogLevel>`_ * `GetRepetitionCounting <#GetRepetitionCounting>`_ * `GetTimestamp <#GetTimestamp>`_ * `GetTraceMask <#GetTraceMask>`_ * `GetTraceMasks <#GetTraceMasks>`_ * `GetVerbose <#GetVerbose>`_ * `IsAllowedTraceMask <#IsAllowedTraceMask>`_ * `IsEnabled <#IsEnabled>`_ * `OnLog <#OnLog>`_ * `RemoveTraceMask <#RemoveTraceMask>`_ * `Resume <#Resume>`_ * `SetActiveTarget <#SetActiveTarget>`_ * `SetLogLevel <#SetLogLevel>`_ * `SetRepetitionCounting <#SetRepetitionCounting>`_ * `SetTimestamp <#SetTimestamp>`_ * `SetTraceMask <#SetTraceMask>`_ * `SetVerbose <#SetVerbose>`_ * `Suspend <#Suspend>`_ * `TimeStamp <#TimeStamp>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `No docstrings available for this method.` -------- .. method:: AddTraceMask(mask) Add the `mask` to the list of allowed masks for `wx.LogTrace `_. **Parameters:** * `mask` (string) .. seealso:: `RemoveTraceMask <#RemoveTraceMask>`_, `GetTraceMasks <#GetTraceMasks>`_ -------- .. method:: ClearTraceMasks() Removes all trace masks previously set with `AddTraceMask <#AddTraceMask>`_. .. seealso:: `RemoveTraceMask <#RemoveTraceMask>`_ -------- .. method:: Destroy() `No docstrings available for this method.` -------- .. 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 <#ClearTraceMasks>`_. -------- .. method:: EnableLogging(doIt=True) | **Parameters:** * `doIt` (bool) | **Returns:** `bool` -------- .. method:: Flush() Shows all the messages currently in buffer and clears it. If the buffer is already empty, nothing happens. -------- .. method:: FlushActive() Flushes the current log target if any, does nothing if there is none. .. seealso:: `Flush <#Flush>`_ -------- .. method:: GetActiveTarget() Returns the pointer to the active log target (may be ``None``). | **Returns:** `wx.Log `_ -------- .. method:: GetLogLevel() Returns the current log level limit. | **Returns:** `int` -------- .. method:: GetRepetitionCounting() Returns whether the repetition counting mode is enabled. | **Returns:** `bool` -------- .. method:: GetTimestamp() Returns the current timestamp format string. | **Returns:** `string` -------- .. method:: GetTraceMasks() Returns the currently allowed list of string trace masks. | **Returns:** `list of strings` .. seealso:: `AddTraceMask <#AddTraceMask>`_. -------- .. method:: GetVerbose() Returns whether the verbose mode is currently active. | **Returns:** `bool` -------- .. method:: IsAllowedTraceMask(mask) Returns ``True`` if the `mask` is one of allowed masks for `wx.LogTrace `_. **Parameters:** * `mask` (string) | **Returns:** `bool` .. seealso:: `AddTraceMask <#AddTraceMask>`_, `RemoveTraceMask <#RemoveTraceMask>`_ -------- .. method:: IsEnabled() `No docstrings available for this method.` -------- .. 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) -------- .. method:: RemoveTraceMask(mask) Remove the `mask` from the list of allowed masks for `wx.LogTrace `_. **Parameters:** * `mask` (string) .. seealso:: `AddTraceMask <#AddTraceMask>`_ -------- .. method:: Resume() Resumes logging previously suspended by a call to `Suspend <#Suspend>`_. All messages logged in the meanwhile will be flushed soon. -------- .. method:: 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:** * `logtarget` (`wx.Log `_) | **Returns:** `wx.Log `_ -------- .. method:: SetLogLevel(logLevel) Specifies that log messages with level > `logLevel` should be ignored and not sent to the active log target. **Parameters:** * `logLevel` (int) -------- .. method:: 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) -------- .. method:: 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) -------- .. method:: SetTraceMask(mask) Sets the trace mask **Parameters:** * `mask` (string) -------- .. method:: 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) -------- .. method:: Suspend() Suspends the logging until `Resume <#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 <#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). .. seealso:: `Resume <#Resume>`_, `wx.LogNull `_ -------- .. method:: TimeStamp() `No docstrings available for this method.`