lib/stormpath.js
function initClient(app, opts) {
  opts.userAgent = userAgent;

  var logger = opts.logger;

  if (!logger) {
    logger = new winston.Logger({
      transports: [
        new winston.transports.Console({
          colorize: true,
          level: opts.debug || 'error'
        })
      ]
    });
  }

  app.set('stormpathLogger', logger);

  var client = require('./client')(opts);

  client.on('error', function (err) {
    logger.error(err);
    app.emit('stormpath.error', err);
  });

  client.on('ready', function () {
    app.set('stormpathClient', client);
    app.set('stormpathConfig', client.config);
  });

  return client;
}
function initClient(app, opts) {
  opts.userAgent = userAgent;

  var logger = opts.logger;

  if (!logger) {
    logger = new winston.Logger({
      transports: [
        new winston.transports.Console({
          colorize: true,
          level: opts.debug || 'error'
        })
      ]
    });
  }

  app.set('stormpathLogger', logger);

  var client = require('./client')(opts);

  client.on('error', function (err) {
    logger.error(err);
    app.emit('stormpath.error', err);
  });

  client.on('ready', function () {
    app.set('stormpathClient', client);
    app.set('stormpathConfig', client.config);
  });

  return client;
}
function initClient ( app , opts ) { opts . userAgent = userAgent ; var logger = opts . logger ; if ( ! logger ) { logger = new winston . Logger ( { transports : [ new winston . transports . Console ( { colorize : true , level : opts . debug || 'error' } ) ] } ) ; } app . set ( 'stormpathLogger' , logger ) ; var client = require ( './client' ) ( opts ) ; client . on ( 'error' , function ( err ) { logger . error ( err ) ; app . emit ( 'stormpath.error' , err ) ; } ) ; client . on ( 'ready' , function ( ) { app . set ( 'stormpathClient' , client ) ; app . set ( 'stormpathConfig' , client . config ) ; } ) ; return client ; }
Initialize the Stormpath client.

@method
@private

@param {Object} app - The express application.
@param {object} opts - A JSON hash of user supplied options.

@return {Function} A function which accepts a callback.
Initialize the Stormpath client .