Logging

A resource that provides support for logging messages via Twisted’s logging infrastructure.

class vxsandbox.resources.logging.LoggingResource(name, app_worker, config)[source]

Resource that allows a sandbox to log messages via Twisted’s logging framework.

handle_critical(api, command)[source]

Logs a message at the CRITICAL log level.

See handle_log() for details.

handle_debug(api, command)[source]

Logs a message at the DEBUG log level.

See handle_log() for details.

handle_error(api, command)[source]

Logs a message at the ERROR log level.

See handle_log() for details.

handle_info(api, command)[source]

Logs a message at the INFO log level.

See handle_log() for details.

handle_log(*args, **kwargs)[source]

Log a message at the specified severity level.

The other log commands are identical except that level need not be specified. Using the log-level specific commands is preferred.

Command fields:
  • level: The severity level to log at. Must be an integer log level. Default severity is the INFO log level.
  • msg: The message to log.
Reply fields:
  • success: true if the operation was successful, otherwise false.

Example:

api.request(
    'log.log',
    {level: 20,
     msg: 'Abandon ship!'},
    function(reply) {
        api.log_info('New value: ' +
                     reply.value);
    }
);
handle_warning(api, command)[source]

Logs a message at the WARNING log level.

See handle_log() for details.

log(api, msg, level)[source]

Logs a message via vumi.log (i.e. Twisted logging).

Sub-class should override this if they wish to log messages elsewhere. The api parameter is provided for use by such sub-classes.

The log method should always return a deferred.