Activity Log

The Activity Log provides users with a record of the actions they have performed during the day. It is available within FX Professional as a technology preview and is intended to replace the Activity Blotter when fully released.

Enabling the Activity Log

The Activity Log is enabled by default. To disable the Activity Log, see Configuring the Activity Log.

Opening the Activity Log

To open the Activity Log in FX Professional:

  1. Click Main Menu > Add > Activity Log.

  2. Drag the Activity Log to a position within your screen layout.

Reading the Activity Log

The Activity Log records the timestamp, account, and description of activities.

ActivityLog2

Log entries are stored in web browser local storage. Browser local storage is not synchronised between web browsers, so activities recorded in one browser will not be available in another.

The Activity Log records a single day’s activities only. Entries logged prior to the current calendar day are deleted from the Activity Log on application startup.

Configuring the Activity Log

FX Professional’s default configuration is defined in the options property of caplinx.AppConfig. To override the default configuration, customise the subclass caplinx.ExtendedAppConfig. The definitions of both classes are located in /default-aspect/src/caplinx.

Always include your configuration changes in the definition of caplinx.ExtendedAppConfig. Do not edit the parent class, caplinx.AppConfig.

The table below lists the configuration properties available for activity logging.

caplinx.AppConfig.options object
Property Data Type Description

'DISPLAY.ACTIVITY.LOG'

boolean

To enable the Activity Log and make it available in the main menu, set this property to true. Default value: true.

To assign a new value to 'DISPLAY.ACTIVITY.LOG', assign the value in the constructor of caplinx.ExtendedAppConfig.

caplinx.ExtendedAppConfig = function() {
    caplinx.AppConfig.call(this);
    .
    .
    this.options['DISPLAY.ACTIVITY.LOG'] = false;
    .
    .
};

Using the Activity Log API

The Activity Log integrates with FX Professional’s Emitr and Fell libraries. The Activity Log provides a simple API to register Emitr event handlers that format and write messages to the Activity Log.

Example

This example shows how to write a message to the Activity Log when the Emitr instance myEmitrObject emits the event 'my-emitr-event-name'.

Begin by creating an instance of the ActivityLogger class. Pass the constructor the Emitr object to monitor and a Fell namespace string to log messages under:

var activityLog = new caplinps.logging.activity.ActivityLogger(myEmitrObject, 'myNamespace');

For each Emitr event type you want to write to the Activity Log, register a subclass of LoggerHandler with activityLog. The code sample below registers a handler for the Emitr event 'my-emitr-event-name':

// Extend LoggerHandler
function MyLoggerHandler() {}
MyLoggerHandler.prototype = Object.create(caplinps.logging.activity.LoggerHandler.prototype);

// Override LoggerHandler.getLogMessage
MyLoggerHandler.prototype.getLogMessage = function(data) {
        return 'Action ' + data.action + ' performed'.
    };

// Instantiate MyLoggerHandler
var loggerHandler = new MyLoggerHandler();

// Register loggerHandler as the handler for the 'my-emitr-event-name' event
activityLog.register('my-emitr-event-name', loggerHandler);

When you have registered all required logger handlers, call the initialize method on the ActivityLog instance:

activityLog.initialize();

Now, whenever myEmitrObject emits the 'my-emitr-event-name' event, an entry will be written to the Activity Log. To complete this example, the code sample below shows the triggering of an Emitr event that will now be written to the Activity Log:

var eventDataObject = {action: 'my-action'};
myEmitrObject.trigger('my-emitr-event-name', eventDataObject);

Activity Log API reference

There are two classes in the API:

ActivityLogger

ActivityLogger(emitter, namespace)

Constructor.

emitter — an instance of Emitr

namespace — a Fell namespace string

destroy()

Disposes of all registered handlers and deregisters them with the emitter object

initialize()

Registers logger handlers on the emitter object.

log(message, properties)

Logs a message to the Activity Log directly.

message — log message (string)

properties — properties object or null. To log a message under a trading account other than the current trading-account, pass {account: '<account_name>'} as the value.

registerHandler(eventName, loggerHandler)

Registers a logger handler for a named Emitr event.

eventName — event name (string)

loggerHandler — a subclass of LoggerHandler

LoggerHandler

destroy()

Override to include disposal code.

getLogMessage(data)

Formats the data object as a log message string.

initialize()

Override to include initialisation code.