The Logging Plugin

Todo

Write documentation on logging.js.

logging.py - A plugin for Gate One that provides logging-related functionality.

Hooks

This Python plugin file implements the following hooks:

hooks = {
    'WebSocket': {
        'logging_get_logs': enumerate_logs,
        'logging_get_log_flat': retrieve_log_flat,
        'logging_get_log_playback': retrieve_log_playback,
        'logging_get_log_file': save_log_playback,
    }
}

Docstrings

logging_plugin.retrieve_log_frames(golog_path, rows, cols, limit=None)[source]

Returns the frames of golog_path as a list that can be used with the playback_log.html template.

If limit is given, only return that number of frames (e.g. for preview)

logging_plugin.enumerate_logs(limit=None, tws=None)[source]

Calls _enumerate_logs() via a multiprocessing.Process so it doesn't cause the IOLoop to block.

Log objects will be returned to the client one at a time by sending 'logging_log' actions to the client over the WebSocket (tws).

logging_plugin._enumerate_logs(queue, user, users_dir, limit=None)[source]

Enumerates all of the user's logs and sends the client a "logging_logs" message with the result.

If limit is given, only return the specified logs. Works just like MySQL: limit="5,10" will retrieve logs 5-10.

logging_plugin.retrieve_log_flat(settings, tws=None)[source]

Calls _retrieve_log_flat() via a multiprocessing.Process so it doesn't cause the IOLoop to block.

Parameters:
  • settings (dict) -- A dict containing the log_filename, colors, and theme to use when generating the HTML output.
  • tws (instance) -- The current gateone.TerminalWebSocket instance (connected).

Here's the details on settings:

Parameters:
  • settings['log_filename'] -- The name of the log to display.
  • settings['colors'] -- The CSS color scheme to use when generating output.
  • settings['theme'] -- The CSS theme to use when generating output.
  • settings['where'] -- Whether or not the result should go into a new window or an iframe.
logging_plugin._retrieve_log_flat(queue, settings)[source]

Writes the given log_filename to queue in a flat format equivalent to:

./logviewer.py --flat log_filename

settings - A dict containing the log_filename, colors, and theme to use when generating the HTML output.

logging_plugin.retrieve_log_playback(settings, tws=None)[source]

Calls _retrieve_log_playback() via a multiprocessing.Process so it doesn't cause the IOLoop to block.

logging_plugin._retrieve_log_playback(queue, settings)[source]

Writes a JSON-encoded message to the client containing the log in a self-contained HTML format similar to:

./logviewer.py log_filename

settings - A dict containing the log_filename, colors, and theme to use when generating the HTML output.

Parameters:
  • settings['log_filename'] -- The name of the log to display.
  • settings['colors'] -- The CSS color scheme to use when generating output.
  • settings['theme'] -- The CSS theme to use when generating output.
  • settings['where'] -- Whether or not the result should go into a new window or an iframe.

The output will look like this:

{
    'result': "Success",
    'log': <HTML rendered output>,
    'metadata': {<metadata of the log>}
}

It is expected that the client will create a new window with the result of this method.

logging_plugin.save_log_playback(settings, tws=None)[source]

Calls _save_log_playback() via a multiprocessing.Process so it doesn't cause the IOLoop to block.

logging_plugin._save_log_playback(queue, settings)[source]

Writes a JSON-encoded message to the client containing the log in a self-contained HTML format similar to:

./logviewer.py log_filename

The difference between this function and _retrieve_log_playback() is that this one instructs the client to save the file to disk instead of opening it in a new window.

Parameters:
  • settings['log_filename'] -- The name of the log to display.
  • settings['colors'] -- The CSS color scheme to use when generating output.
  • settings['theme'] -- The CSS theme to use when generating output.
  • settings['where'] -- Whether or not the result should go into a new window or an iframe.

The output will look like this:

{
    'result': "Success",
    'data': <HTML rendered output>,
    'mimetype': 'text/html'
    'filename': <filename of the log recording>
}

It is expected that the client will create a new window with the result of this method.

Table Of Contents

Previous topic

The Help Plugin

Next topic

The Notice Plugin

This Page