How to use the debug.disable function in debug

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 PearInc / PearPlayer.js / src / index.downloader.js View on Github external
function PearDownloader(urlStr, token, opts) {
    var self = this;
    if (!(self instanceof PearDownloader)) return new PearDownloader(urlStr, token, opts);
    // if (!(self instanceof PearPlayer)) return new PearPlayer(selector, opts);
    if (typeof token === 'object') return PearDownloader(urlStr, '', token);

    //validate
    if (opts.algorithm && ['push', 'pull'].indexOf(opts.algorithm) == -1) throw new Error('Algorithm ' + opts.algorithm + ' is not supported');


    if (!opts) opts = {};
    if (opts.debug) {
        debug.enable('pear:*');
    } else {
        debug.disable();
    }
    self.version = version;
    console.info('pear version:'+version);

    Worker.call(self, urlStr, token, opts);
}
github sanity-io / sanity / example-app / components / Main.js View on Github external
import Debug from 'debug'
import MyCustomLatLonInput from './MyCustomLatLonInput'
import ValidationList from './ValidationList'

// Todo: figure out why it complains so much
// import {whyDidYouUpdate} from 'why-did-you-update'
import schemas from '../schemas'
import {
  compileSchema,
  inputComponents,
  fieldComponents,
  BlockEditor,
  DefaultField
} from '../../src'

Debug.disable('*')

// whyDidYouUpdate(React)

if (process.env.DEBUG) {
  Debug.enable(process.env.DEBUG)
}

const VALID_SCHEMA_NAMES = Object.keys(schemas)
const [SCHEMA_NAME, TYPE_NAME] = document.location.pathname.split('/').filter(Boolean)

function renderSchemas() {
  return (
    <ul>
      {VALID_SCHEMA_NAMES.map(name =&gt; (
        <li>
          <a href="{`/${name}`}">{name}</a></li></ul>
github NorthernMan54 / homebridge-alexa / plugin.js View on Github external
this.pin = config['pin'] || "031-45-154";
  this.username = config['username'] || false;
  this.password = config['password'] || false;
  this.filter = config['filter'];
  this.beta = config['beta'] || false;
  this.events = config['routines'] || false;
  this.combine = config['combine'] || false;
  this.oldParser = config['oldParser'] || false;
  this.refresh = config['refresh'] || 60 * 15; // Value in seconds, default every 15 minute's
  this.speakers = config['speakers'] || false; // Array of speaker devices

  // Enable config based DEBUG logging enable
  this.debug = config['debug'] || false;
  if (this.debug) {
    let debugEnable = require('debug');
    let namespaces = debugEnable.disable();

    // this.log("DEBUG-1", namespaces);
    if (namespaces) {
      namespaces = namespaces + ',alexa*';
    } else {
      namespaces = 'alexa*';
    }
    // this.log("DEBUG-2", namespaces);
    debugEnable.enable(namespaces);
  }

  if (!this.username || !this.password) {
    this.log.error("Missing username and password");
  }

  if (api) {
github NorthernMan54 / homebridge-mcuiot / index.js View on Github external
function mcuiot(log, config, api) {
  this.log = log;
  this.config = config;
  this.refresh = config['refresh'] || 60; // Update every minute
  this.leak = config['leak'] || 10; // Leak detected threshold
  this.battery = config['battery'] || 69; // Battery low
  this.port = config['port'] || 8080; // Default http port
  this.storage = config['storage'] || "fs";
  this.leakDetected = Date.now(); // Leak detection flapping fix

  // Enable config based DEBUG logging enable
  this.debug = config['debug'] || false;
  if (this.debug) {
    let debugEnable = require('debug');
    let namespaces = debugEnable.disable();

    // this.log("DEBUG-1", namespaces);
    if (namespaces) {
      namespaces = namespaces + ',MCUIOT';
    } else {
      namespaces = 'MCUIOT';
    }
    // this.log("DEBUG-2", namespaces);
    debugEnable.enable(namespaces);
  }

  debug("Settings: refresh=%s, leak=%s", this.refresh, this.leak);

  this.spreadsheetId = config['spreadsheetId'];
  if (this.spreadsheetId) {
    this.logger = new Logger(this.spreadsheetId);
github nock / nock / tests / test_logging.js View on Github external
t.once('end', () => {
    debug.disable('nock.interceptor')
  })
github wordpress-clients / hybrid / src / providers / config.ts View on Github external
constructor() {
        if (__DEV__) {
            debug.enable(this.getDev('log'));
        } else {
            debug.disable();
        }
        log('app config', this.config);
    }
    getRaw = () => this.config;
github ournameismud / mud-fractal / src / js / plugins / logger.js View on Github external
import debug from 'debug'

window.log = debug('app:log')

process.env.NODE_ENV === 'development'
	? debug.enable('app:log')
	: debug.disable('app:log')

log(`Logging is enabled!, NODE_ENV: ${process.env.NODE_ENV}`)
github vesparny / morpheus / shared / actions / ContentActions.js View on Github external
function buildAppGlobalsPayload(config) {
  var debug = require('debug');
  if (config.debug) {
    debug.enable('*');
  } else {
    debug.disable();
  }
  return {
    siteTitle: config.siteTitle,
    siteUrl: config.siteUrl,
    siteDescription: config.siteDescription,
    authors: config.authors,
    googleAnalytics: config.googleAnalytics,
    disqusComments: config.disqusComments,
    version: config.version  
  };
}
github janbiasi / monopacker / src / Packer.ts View on Github external
public async teardown(): Promise {
		debug.disable();
		process.chdir(this.originalCwd);
	}