How to use the sails/node_modules/sails-util.inspect function in sails

To help you get started, we’ve selected a few sails examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sailshq / treeline1 / index.js View on Github external
}, function (err, response) {

      // Login failed - could be various reasons
      if (err) {
        if (err.status === 400 && err.errors) {
          log.error('Login failed.');
          log('Sorry, I don\'t recognize that username/password combination.');
          log('Please try again, or hit  to cancel.'.grey);
          return doLogin(cb);
        }
        return cb(err);
      }

      if (!response || !response.secret) {
        return cb('Unexpected response from Treeline (no secret):' + util.inspect(response));
      }


      var credentials = {
        secret: response.secret,
        username: response.username || '???',
        accountId: response.id
      };

      // If login was successful stringify and write the credentials file to disk
      fse.outputJSON( path.resolve(conf.config.pathToCredentials),
        credentials, function (err) {
        if (err) {
          log.error('Login failed.');
          log('Could not stringify and/or save Treeline credentials file in the configured directory ('+pathToCredentials+')');
          log('That directory may not exist, or there could be a permissions issue.'.grey);
github sailshq / treeline1 / index.js View on Github external
credentials, function (err) {
        if (err) {
          log.error('Login failed.');
          log('Could not stringify and/or save Treeline credentials file in the configured directory ('+pathToCredentials+')');
          log('That directory may not exist, or there could be a permissions issue.'.grey);
          return cb(util.inspect(err));
        }

        log();
        _logHR();
        log('This computer is now logged in to Treeline as '+((credentials.username).cyan));
        log(('Treeline credentials were saved in `'+conf.config.pathToCredentials+'`').grey);
        log('You can change the location of this file by running `treeline configure`'.grey);
        conf.credentials = credentials;

        // Clear out projects so they'll be re-fetched
        conf.projects = null;

        return cb();
      });
    });