exopy.app.log.plugin module

Log plugin definition.

class exopy.app.log.plugin.LogPlugin[source]

Bases: enaml.workbench.plugin.Plugin

Plugin managing the application logging.

handler_ids

List of installed handlers.

filter_ids

List of installed filters.

gui_model

Model which can be used to display the log in the GUI. It is associated to a handler attached to the root logger.

rotating_log

A value which allows objects of a given type or types.

Values will be tested using the PyObject_TypeCheck C API call. This call is equivalent to type(obj) in cls.mro(). It is less flexible but faster than Instance. Use Instance when allowing heterogenous values and Typed when the value type is explicit.

The value of a Typed may be set to None

display_current_log()[source]

Display the current instance of the rotating log file.

add_handler(id, handler=None, logger='', mode=None)[source]

Add a handler to the specified logger.

Parameters
  • id (unicode) – Id of the new handler. This id should be unique.

  • handler (logging.Handler, optional) – Handler to add.

  • logger (unicode, optional) – Name of the logger to which the handler should be added. By default the handler is added to the root logger.

  • mode ({'ui', }, optional) – Conveninence to add a simple logger. If this argument is specified, handler will be ignored and the command will return useful references (the model to which can be connected a ui for the ‘ui’ mode).

Returns

refs – List of useful reference, empty if no mode is selected.

Return type

list

remove_handler(id)[source]

Remove the specified handler.

Parameters

id (unicode) – Id of the handler to remove.

add_filter(id, filter, handler_id)[source]

Add a filter to the specified handler.

Parameters
  • id (unicode) – Id of the filter to add.

  • filter (object) – Filter to add to the specified handler (object implemeting a filter method).

  • handler_id (unicode) – Id of the handler to which this filter should be added

remove_filter(id)[source]

Remove the specified filter.

Parameters

id (unicode) – Id of the filter to remove.

set_formatter(handler_id, formatter)[source]

Set the formatter of the specified handler.

Parameters
  • handler_id (unicode) – Id of the handler whose formatter shoudl be set.

  • formatter (Formatter) – Formatter for the handler.