How to use the loglevel.setDefaultLevel function in loglevel

To help you get started, we’ve selected a few loglevel 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 shellscape / mocha-chrome / index.js View on Github external
chromeLauncher: {},
        loadTimeout: 1000,
        logLevel: 'error',
        ignoreExceptions: false,
        ignoreConsole: false,
        ignoreResourceErrors: false,
        mocha: {
          reporter: 'spec',
          ui: 'bdd',
          useColors: true
        }
      },
      options
    );

    log.setDefaultLevel('error');
    log.setLevel(options.logLevel);

    const bus = new EventBus(log);

    if (!options.url) {
      this.fail('`options.url` must be specified to run tests');
    }

    bus.on('ready', (/* content */) => {
      this.client.Runtime.evaluate({ expression: `mocha.setup({ reporter: 'spec' })` });
    });

    bus.on('mocha', (content) => {
      process.stdout.write(content);
    });
github brave / ethereum-remote-client / app / scripts / inpage.js View on Github external
}
}

cleanContextForImports()
require('web3/dist/web3.min.js')
const log = require('loglevel')
const LocalMessageDuplexStream = require('post-message-stream')
const setupDappAutoReload = require('./lib/auto-reload.js')
const MetamaskInpageProvider = require('metamask-inpage-provider')
const createStandardProvider = require('./createStandardProvider').default

let warned = false

restoreContextAfterImports()

log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn')

//
// setup plugin communication
//

// setup background connection
const metamaskStream = new LocalMessageDuplexStream({
  name: 'inpage',
  target: 'contentscript',
})

// compose the inpage provider
const inpageProvider = new MetamaskInpageProvider(metamaskStream)

// set a high max listener count to avoid unnecesary warnings
inpageProvider.setMaxListeners(100)
github brave / ethereum-remote-client / development / verify-locale-strings.js View on Github external
// The optional '--quiet' parameter reduces the verbosity of the output, printing
// just a single summary of results for each locale verified
//
// //////////////////////////////////////////////////////////////////////////////

const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const log = require('loglevel')
const matchAll = require('string.prototype.matchall').getPolyfill()
const localeIndex = require('../app/_locales/index.json')
const readdir = promisify(fs.readdir)
const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)

log.setDefaultLevel('info')

let fix = false
let specifiedLocale
for (const arg of process.argv.slice(2)) {
  if (arg === '--fix') {
    fix = true
  } else if (arg === '--quiet') {
    log.setLevel('error')
  } else {
    specifiedLocale = arg
  }
}

main(specifiedLocale, fix)
  .catch(error => {
    log.error(error)
github brave / ethereum-remote-client / app / scripts / inpage.js View on Github external
}
}

cleanContextForImports()

const log = require('loglevel')
const LocalMessageDuplexStream = require('post-message-stream')
const MetamaskInpageProvider = require('metamask-inpage-provider')

// TODO:deprecate:2020-01-13
require('web3/dist/web3.min.js')
const setupDappAutoReload = require('./lib/auto-reload.js')

restoreContextAfterImports()

log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn')

//
// setup plugin communication
//

// setup background connection
const metamaskStream = new LocalMessageDuplexStream({
  name: 'inpage',
  target: 'contentscript',
})

// compose the inpage provider
const inpageProvider = new MetamaskInpageProvider(metamaskStream)

// set a high max listener count to avoid unnecesary warnings
inpageProvider.setMaxListeners(100)
github bitlum / bitlum-front / app / sources / src / utils / logging.js View on Github external
// In case someone stringifyed error object as you can in Bull queue
          try {
            errorObject = JSON.parse(errorObject.message);
            errorObject = errorObject.error || errorObject;
          } catch (e) {}
        }
        formattedMessage = `${errorObject.message} (${errorObject.code || 0}) ${stack}`;
      }
    }

    return rawMethod(prefix, formattedMessage);
  };
};

if (process.env.NODE_ENV === 'development') {
  loglevel.setDefaultLevel(loglevel.levels.DEBUG);
  loglevel.setLevel(loglevel.levels.DEBUG);
}
if (process.env.NODE_ENV === 'production') {
  loglevel.setDefaultLevel(loglevel.levels.INFO);
  loglevel.setLevel(loglevel.levels.INFO);
}
if (process.env.NODE_ENV === 'test') {
  loglevel.setDefaultLevel(loglevel.levels.SILENT);
  loglevel.setLevel(loglevel.levels.SILENT);
}

const internalLogger = loglevel.getLogger('Logger');

export default name => ({ ...loglevel.getLogger(name || 'general') });
github Infosys / enterprise-angular-seed / src / app / app.component.ts View on Github external
ngOnInit(): void {
    log.setLevel(environment.LOG_LEVEL);
    log.setDefaultLevel(environment.LOG_LEVEL);

    this.userService.getUserInfo().subscribe((user: User) => {
      user.permissions.forEach(perm => {
        this.permsService.addPermission(perm);
      });
    });
  }
  getState(outlet) {
github bitlum / bitlum-front / app / sources / src / utils / logging.js View on Github external
}

    return rawMethod(prefix, formattedMessage);
  };
};

if (process.env.NODE_ENV === 'development') {
  loglevel.setDefaultLevel(loglevel.levels.DEBUG);
  loglevel.setLevel(loglevel.levels.DEBUG);
}
if (process.env.NODE_ENV === 'production') {
  loglevel.setDefaultLevel(loglevel.levels.INFO);
  loglevel.setLevel(loglevel.levels.INFO);
}
if (process.env.NODE_ENV === 'test') {
  loglevel.setDefaultLevel(loglevel.levels.SILENT);
  loglevel.setLevel(loglevel.levels.SILENT);
}

const internalLogger = loglevel.getLogger('Logger');

export default name => ({ ...loglevel.getLogger(name || 'general') });
github sulu / sulu / src / Sulu / Bundle / AdminBundle / Resources / js / index.js View on Github external
TypeToolbarAction as FormTypeToolbarAction,
    TogglerToolbarAction as FormTogglerToolbarAction,
} from './views/Form';
import {navigationRegistry} from './containers/Navigation';
import {smartContentConfigStore} from './containers/SmartContent';
import PreviewForm from './views/PreviewForm';
import FormOverlayList from './views/FormOverlayList';

configure({enforceActions: 'observed'});

if (!window.ResizeObserver) {
    window.ResizeObserver = ResizeObserver;
}

window.log = log;
log.setDefaultLevel(process.env.NODE_ENV === 'production' ? log.levels.ERROR : log.levels.TRACE);

Requester.handleResponseHooks.push(logoutOnUnauthorizedResponse);

jexl.addTransform('length', (value: Array<*>) => value.length);
jexl.addTransform('values', (value: Array<*>) => Object.values(value));

const FIELD_TYPE_BLOCK = 'block';
const FIELD_TYPE_CHANGELOG_LINE = 'changelog_line';
const FIELD_TYPE_CHECKBOX = 'checkbox';
const FIELD_TYPE_COLOR = 'color';
const FIELD_TYPE_DATE = 'date';
const FIELD_TYPE_DATE_TIME = 'datetime';
const FIELD_TYPE_EMAIL = 'email';
const FIELD_TYPE_HEADING = 'heading';
const FIELD_TYPE_NUMBER = 'number';
const FIELD_TYPE_PASSWORD_CONFIRMATION = 'password_confirmation';
github victorhaggqvist / touch-imagelightbox / src / LightBox.js View on Github external
/**
 * @author Victor Häggqvist
 * @since 2016-01-12
 */

import {CSSUtil} from './CSSUtil'
import {LightDirection} from './LightDirection'
var log = require('loglevel');

log.setDefaultLevel(log.levels.DEBUG);

export default class LightBox {

    constructor(targetSelector, options = {}) {
        log.info('LightBox');
        this.targets = document.querySelectorAll(targetSelector);
        log.debug(this.targets);

        log.debug('HAS_TOUCH '+LightBox.HAS_TOUCH);
        const defaultOptions = {
            allowedTypes:   'png|jpg|jpeg|gif',
            restrictTypes:  false,
            selectorId:     'imagelightbox',
            animationSpeed: 350,
            preloadNext:    true,
            enableKeyboard: true,
github medic / couch2pg / env.js View on Github external
log.info('');
    log.info('  Examples:');
    log.info('');
    log.info('    $ couch2pg "http://admin:pass@localhost:5984/db" "postgres://user:pass@localhost:5432/db"');
  });

  program.parse(process.argv);

  if (!couchdbUrl || !postgresqlUrl) {
    program.help();
  }

  if (program.verbose) {
    log.setDefaultLevel('debug');
  } else {
    log.setDefaultLevel('info');
  }

  return {
    couchdbUrl: couchdbUrl,
    postgresqlUrl: postgresqlUrl,
    couch2pgDocLimit: program['doc-limit'],
    couch2pgChangesLimit: program['changes-limit'],
    continuous: program.daemon,
    sleepMs: 10 * 60 * 60 * 1000
  };
};