How to use debug - 10 common examples

To help you get started, we’ve selected a few debug 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 davideicardi / live-plugin-manager / test / PluginManagerSuite.ts View on Github external
it("dependencies is not the same", async function() {
				const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
				await manager.installFromPath(pluginSourcePath);

				const pluginDebugInstance = manager.require("debug/package.json");
				// tslint:disable-next-line:no-submodule-imports
				const hostDebugInstance = require("debug/package.json");

				assert.equal(pluginDebugInstance.version, "2.6.9");
				assert.equal(hostDebugInstance.version.substring(0, 1), "4");

				assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
			});
		});
github davideicardi / live-plugin-manager / test / PluginManagerSuite.ts View on Github external
it("dependencies is not the same", async function() {
				const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
				await manager.installFromPath(pluginSourcePath);

				const pluginDebugInstance = manager.require("debug/package.json");
				// tslint:disable-next-line:no-submodule-imports
				const hostDebugInstance = require("debug/package.json");

				assert.equal(pluginDebugInstance.version, "2.6.9");
				assert.equal(hostDebugInstance.version.substring(0, 1), "4");

				assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
			});
		});
github MitocGroup / recink / components / e2e / src / testcafe / puppeteer-browser-provider.es6 View on Github external
openedPages: {},

  /**
   * Multiple browsers support
   * @type {Boolean}
   */
  isMultiBrowser: false,

  /**
   * Puppeteer initialization options
   * @type {*}
   * @private
   */
  _options: {
    ignoreHTTPSErrors: true,
    headless: !debug.enabled('puppeteer'),
    slowMo: debug.enabled('puppeteer') ? 250 : 0,
    timeout: 60000,
    dumpio: debug.enabled('puppeteer'),

    // avoid issues in Travis
    args: Env.isCI ? [ '--no-sandbox', '--disable-setuid-sandbox' ] : [],
  },

  /**
   * Open new page in browser
   * @param {String} id
   * @param {String} pageUrl
   * @returns {Promise}
   */
  async openBrowser(id, pageUrl) {
    const browser = await puppeteer.launch(this._options);
github thumbsup / thumbsup / test / log.js View on Github external
const debug = require('debug')
const util = require('util')

debug.recorded = []

// enable all logs while running the tests
debug.enable('thumbsup:*')

// don't format the logs to avoid any extra ANSI codes
debug.formatArgs = function (args) {
}

// capture the logs instead of displaying them
debug.log = function () {
  const message = util.format.apply(null, arguments)
  debug.recorded.push(`${this.namespace} ${message}`)
}

debug.reset = function () {
  debug.recorded = []
}

debug.assertContains = function (expected) {
  const matches = debug.recorded.filter(message => {
    return message.includes(expected)
  })
github davideicardi / live-plugin-manager / test / PluginManagerSuite.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
                    const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
                    yield manager.installFromPath(pluginSourcePath);
                    const pluginDebugInstance = manager.require("debug/package.json");
                    // tslint:disable-next-line:no-submodule-imports
                    const hostDebugInstance = require("debug/package.json");
                    chai_1.assert.equal(pluginDebugInstance.version, "2.6.9");
                    chai_1.assert.equal(hostDebugInstance.version.substring(0, 1), "4");
                    chai_1.assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
                });
            });
github davideicardi / live-plugin-manager / test / PluginManagerSuite.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
                    const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
                    yield manager.installFromPath(pluginSourcePath);
                    const pluginDebugInstance = manager.require("debug/package.json");
                    // tslint:disable-next-line:no-submodule-imports
                    const hostDebugInstance = require("debug/package.json");
                    chai_1.assert.equal(pluginDebugInstance.version, "2.6.9");
                    chai_1.assert.equal(hostDebugInstance.version.substring(0, 1), "4");
                    chai_1.assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
                });
            });
github codesandbox / codesandbox-client / src / app / utils / debug.js View on Github external
return (key: string) => (message: string) => {
      if (typeof window.Raven === 'object') {
        try {
          Raven.captureBreadcrumb({
            message: `${key} - ${message}`,
            category: 'logging',
          });
        } catch (e) {
          console.error(e);
        }
      }
    };
  }

  const debug = require('debug'); // eslint-disable-line global-require
  debug.enable('cs:*');
  return debug;
};
github khalidx / resource-x / src / cli.ts View on Github external
async function onError (error: any): Promise {
  // If debug is on, log the entire error object, otherwise log just the message
  log('error', debug.enabled('rx:cli') ? error : error.message)
  process.exit(1)
}
github dreamnettech / dreamtime / src / gui / electron / telemetry / sentry.js View on Github external
const Sentry = require('@sentry/electron')
const debug = require('debug').default('app:electron:telemetry:sentry')

const { settings } = require('../modules')

const instance = {
  init() {
    if (!this.can()) {
      return
    }

    const config = {
      dsn: process.env.SENTRY_DSN,
      release: process.env.npm_package_version,
      environment: process.env.NODE_ENV
    }

    // Send any error to Sentry
github localnerve / react-pwa-reference / src / application / client / sw / node_modules / sw / utils / debug.js View on Github external
.catch(function () {
        // silent failure
      });
  }

  return idb.put(idb.stores.state, key, namespaces)
    .catch(function (error) {
      console.error('debug failed to save namespace', error);
    });
};

/***
 * Echo the functionality of debugLib.
 * On module load, enable from storage.
 */
debugLib.load().then(function (namespaces) {
  debugLib.enable(namespaces);
});

/**
 * Wrap the main debugLib function
 *
 * @param {String} namespace
 * @returns {Function} The debug function for chaining.
 */
export default function debugWrapper (namespace) {
  return debugLib('sw:'+namespace);
}

// Mixin all debugLib props and methods
// eslint-disable-next-line no-unused-vars
for (let item in debugLib) {