Skip to content

Log

Stats from running flow

It is possible to have extra stats logged from a running flow - these items will get logged when the flow finishes along with timing and other info.

js
// Set multiple statistics at once by assigning an object
Log.flowStats = {
  foo: 1200,       // Store numeric value
  bar: "abc"       // Store string value
};

// Or add/update individual statistic values
Log.flowStats.qux = true;     // Store boolean value
Log.flowStats.count = 42;     // Add another statistic

// These values will be logged when the flow completes

Debug, Info, Warn, Error and Fatal

Inserts a line with the appropriate log level in the log.

Parameters

  • key the key of the message - keep this as a constant
  • text the text to insert
javascript
// Log messages at different severity levels
// Each takes a consistent key (for filtering) and the message text
Log.debug('watch-this','A bug in the hand is better than 10 on the root'); // Lowest level - detailed debug info
Log.Info('greeting', 'Hello there');                                        // General information messages
Log.warn('stay-away','You cant go in there');                               // Warning conditions
Log.error('not-as-planned', 'It did no go according to plan');             // Error conditions
Log.fatal('very-wrong', 'We should never get to here. Its bad.');          // Critical errors - highest level

Set log level

Controls the log verbosity of the application driver.

Parameters

  • level the new log level. Must be one of the following: none, fatal, error, warn, info, debug.
  • options optional additional options
    • useStdOut (defaults to false) boolean value indicating if instrumentation log should go to the application stdout or to manatee log.
javascript
// Set the driver's logging level to 'info' (will show info, warn, error, and fatal logs)
// Also redirect logs to standard output instead of the Manatee log file
Log.setDriverLogging('info', { useStdOut: true });