How to use the debug.default 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 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 IBM / openapi-to-graphql / packages / openapi-to-graphql / lib / oas_3_tools.js View on Github external
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
// Imports:
const Swagger2OpenAPI = require("swagger2openapi");
const OASValidator = require("oas-validator");
const debug_1 = require("debug");
const utils_1 = require("./utils");
const httpLog = debug_1.default('http');
const preprocessingLog = debug_1.default('preprocessing');
const translationLog = debug_1.default('translation');
// OAS constants
exports.OAS_OPERATIONS = [
    'get',
    'put',
    'post',
    'patch',
    'delete',
    'options',
    'head'
];
exports.SUCCESS_STATUS_RX = /2[0-9]{2}|2XX/;
/**
 * Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
 * if errors occur.
github spotify / web-scripts / packages / web-scripts / src / Tasks / TestTask.ts View on Github external
import { default as spawn } from 'cross-spawn';
import { default as Debug } from 'debug';
import { SpawnSyncReturns } from 'child_process';
import { hasConfig } from '@spotify/web-scripts-utils';

import { TestTaskDesc } from '../SharedTypes';
import { JEST_CONFIG } from '../Paths';

const dbg = Debug('web-scripts:test'); // eslint-disable-line new-cap

export function getJestConfig(): string | null {
  if (
    !hasConfig([
      { type: 'file', pattern: 'jest.config.js' },
      { type: 'package.json', property: 'jest' },
    ])
  ) {
    return JEST_CONFIG;
  }

  return null;
}

export function testTask(task: TestTaskDesc): SpawnSyncReturns {
  // `coverageDirectory` is necessary because the root is `src`
github IBM / openapi-to-graphql / packages / openapi-to-graphql / lib / auth_builder.js View on Github external
"use strict";
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: openapi-to-graphql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
Object.defineProperty(exports, "__esModule", { value: true });
const graphql_1 = require("graphql");
// Imports:
const schema_builder_1 = require("./schema_builder");
const Oas3Tools = require("./oas_3_tools");
const debug_1 = require("debug");
const utils_1 = require("./utils");
const preprocessor_1 = require("./preprocessor");
const translationLog = debug_1.default('translation');
/**
 * Load the field object in the appropriate root object
 *
 * i.e. inside either rootQueryFields/rootMutationFields or inside
 * rootQueryFields/rootMutationFields for further processing
 */
function createAndLoadViewer(queryFields, data, isMutation = false) {
    let results = {};
    /**
     * To ensure that viewers have unique names, we add a numerical postfix.
     *
     * This object keeps track of what the postfix should be.
     *
     * The key is the security scheme type and the value is
     * the current highest postfix used for viewers of that security scheme type.
     */
github spotify / web-scripts / packages / web-scripts / src / Tasks / LintTask.ts View on Github external
import { default as spawn } from 'cross-spawn-promise';
import { default as Debug } from 'debug';
import { hasConfig } from '@spotify/web-scripts-utils';

import { LintTaskDesc } from '../SharedTypes';
import { CONSUMING_ROOT, ESLINT_CONFIG } from '../Paths';

const dbg = Debug('web-scripts:lint'); // eslint-disable-line new-cap

export function getEslintConfig(): string | null {
  if (
    !hasConfig([
      { type: 'file', pattern: '.eslintrc.*' },
      { type: 'package.json', property: 'eslintConfig' },
    ])
  ) {
    return ESLINT_CONFIG;
  }

  return null;
}

export async function lintTask(task: LintTaskDesc): Promise {
  const fns = [eslintRun];
github IBM / openapi-to-graphql / packages / openapi-to-graphql / lib / oas_3_tools.js View on Github external
return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
// Imports:
const Swagger2OpenAPI = require("swagger2openapi");
const OASValidator = require("oas-validator");
const debug_1 = require("debug");
const utils_1 = require("./utils");
const httpLog = debug_1.default('http');
const preprocessingLog = debug_1.default('preprocessing');
const translationLog = debug_1.default('translation');
// OAS constants
exports.OAS_OPERATIONS = [
    'get',
    'put',
    'post',
    'patch',
    'delete',
    'options',
    'head'
];
exports.SUCCESS_STATUS_RX = /2[0-9]{2}|2XX/;
/**
 * Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
 * if errors occur.
 */
function getValidOAS3(spec) {
github shapeshift / hdwallet / integration / src / wallets / keepkey.ts View on Github external
ETHWallet,
  Events,
  supportsDebugLink,
  supportsBTC,
  supportsETH,
  bip32ToAddressNList,
  ActionCancelled,
  HDWalletInfo,
  BTCInputScriptType,
} from '@shapeshiftoss/hdwallet-core'
import { KeepKeyHDWallet, KeepKeyHDWalletInfo, isKeepKey, info } from '@shapeshiftoss/hdwallet-keepkey'
import { NodeWebUSBKeepKeyAdapter } from '@shapeshiftoss/hdwallet-keepkey-nodewebusb'
import { TCPKeepKeyAdapter } from '@shapeshiftoss/hdwallet-keepkey-tcp'
import * as debug from 'debug'

const log = debug.default('keepkey')

const TIMEOUT = 60 * 1000

export function name (): string {
  return 'KeepKey'
}

async function getDevice (keyring: Keyring) {
  try {
    const keepkeyAdapter = NodeWebUSBKeepKeyAdapter.useKeyring(keyring)
    let wallet = await keepkeyAdapter.pairDevice(undefined, true)
    if (wallet)
      console.log("Using attached WebUSB KeepKey for tests")
    return wallet
  } catch (e) {
  }
github melonproject / protocol / bin / compile.ts View on Github external
import * as fs from 'fs';
import * as path from 'path';
import * as glob from 'glob';
import * as solc from 'solc';
import * as mkdirp from 'mkdirp';
import * as R from 'ramda';
import * as rimraf from 'rimraf';

const soliditySourceDirectory = path.join(__dirname, '..', 'src', 'contracts');
const solidityCompileTarget = path.join(__dirname, '..', 'out');

const debug = require('debug').default('melon:protocol:bin');

const findImports = (missingPath: string, b, c) => {
  const query = path.join(soliditySourceDirectory, '**', missingPath);
  const candidates = glob.sync(query);

  if (candidates.length > 1) {
    throw new Error(
      `Multiple source files named ${missingPath} found. ${candidates}`,
    );
  }

  if (candidates.length === 0) {
    throw new Error(`Can not find import named: ${missingPath}`);
  }

  debug('Resolved import', missingPath, candidates[0]);
github dreamnettech / dreamtime / src / gui / deepTools.js View on Github external
const { remote } = require('electron')
const fs = require('fs')
const path = require('path')
const mime = require('mime-types')
const { spawn } = require('child_process')
const EventBus = require('js-event-bus')
const _ = require('lodash')
const gpuInfo = require('gpu-info')
const config = require('./nuxt.config')

const debug = require('debug').default('app:deepTools')

const { app, shell } = remote

/**
 *
 * @param {*} dataURL
 */
function getBase64Data(dataURL) {
  let encoded = dataURL.replace(/^data:(.*;base64,)?/, '')

  if (encoded.length % 4 > 0) {
    encoded += '='.repeat(4 - (encoded.length % 4))
  }

  return encoded
}
github aerogear / offix / packages / sync / src / links / OfflineQueueLink.ts View on Github external
NextLink,
  Observable,
  Operation
} from "apollo-link";
import { hasDirectives } from "apollo-utilities";
import { Observer } from "zen-observable-ts";
import { PersistedData, PersistentStore } from "../PersistentStore";
import { localDirectives, MUTATION_QUEUE_LOGGER } from "../config/Constants";
import { NetworkInfo, NetworkStatus } from "../offline";
import { DataSyncConfig } from "../config";
import { squashOperations } from "../offline/squashOperations";
import * as debug from "debug";
import { OfflineQueueListener } from "../offline";
import { hasClientGeneratedId } from "../cache/createOptimisticResponse";

export const logger = debug.default(MUTATION_QUEUE_LOGGER);

export interface OperationQueueEntry {
  operation: Operation;
  forward: NextLink;
  observer: Observer;
  subscription?: { unsubscribe: () => void };
  optimisticResponse?: any;
}

/**
 * Type used for filtering
 */
export type TYPE_MUTATION = "mutation" | "query";

/**
 * Apollo link implementation used to queue graphql requests.