Initialize your integration and setup logging


optional function startup(logger)




bunyan logger object

The startup method is called once when the integration is first started (or restarted). It should be used to perform any initialization logic that your integration requires. In addition, the startup method is passed a Bunyan logger object which you can cache for later use.

Bunyan is an open source JSON logging library. You can find more information here



Once you have cached the Logger object you can use it to log information to the integration log file. The simplest usage of the Logger is to log string messages using one of the six provided logging levels.

Logger.trace("This is a trace message");
Logger.debug("This is a debug message");"This is an info message");
Logger.warn("This is a warning message");
Logger.error("This is an error message");
Logger.fatal("This is a fatal message");

You can also pass object literals to be converted into JSON and logged. If you are returning a single object you can pass that as the first parameter to any of the Logger methods., "An entity was looked up");
Logger.fatal(error, "There was a fatal error in the doLookup method");

If you want to return multiple objects or properties you can do that as well.

Logger.error({err: err, entity: entity}, "There was an error in the doLookup method");


The following example show how you can cache the logger object within the startup method for use elsewhere in the integration.js file.

// declare a global Logger variable
let Logger;

function startup(logger){
    Logger = logger;"Startup Method Called");

function doLookup(entities, options, cb){{entities, options}, "doLookup was called!");
    cb(null, []);

module.exports = {
    startup: startup

Last updated