Tutorial: 12 - Write Log Files

12 - Write Log Files


Files created when using the framework

Each time the Trace is checked (including automatic retries to ensure fresh data), it will write these files:

  • ..._traceJson.json - the raw Trace JSON, from the same internal API used in the UI. Available for assertions in the traceJson property of the trace helper function response.
  • ..._traceRecord.json - An instance of TraceRecord

When the mitmproxy network capture logs are retrieved, those will also be persisted:

  • ..._proxyLogs.json - Network logs and related, grouped by step. See this class member for details.

Using it for your own debugging

If you find it helpful, you can write your own log files. See this class for additional details.

First, get the helper function:

// get the helper function and create a new instance of the logger
const rootRequire = require('rpcm-root-require');
const Logger = rootRequire('/platform-helpers/logger');
const logger = new Logger();

Then, later in your code, you can write a log file:

// write a log file
logger.log("logFileName", jsonOrString, logger.Outputs.FILE)