How to use js-logger - 10 common examples

To help you get started, we’ve selected a few js-logger 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 archilogic-com / 3dio-js / src / core / configs.js View on Github external
function setLogLevel (val) {
  // update logger
  var logLevelEnum = LOG_STRING_TO_ENUM[val]
  if (logLevelEnum) {
    // set log level
    log.setLevel(logLevelEnum)
    configs.logLevel = val
  } else {
    // handle error
    var errorMessage = 'Unknown log level "' + val + '". Possible are: "' + Object.keys(LOG_STRING_TO_ENUM).join('", "') + '". '
    if (configs.logLevel) {
      // do not change current log level
      errorMessage += 'Log level remains "' + configs.logLevel
    } else {
      // set default log level
      var defaultVal = defaults.logLevel
      errorMessage += 'Fallback to default "' + defaultVal + '".'
      log.setLevel(LOG_STRING_TO_ENUM[defaultVal])
      configs.logLevel = defaultVal
    }
    console.error(errorMessage)
  }
github archilogic-com / 3dio-js / src / core / configs.js View on Github external
var logLevelEnum = LOG_STRING_TO_ENUM[val]
  if (logLevelEnum) {
    // set log level
    log.setLevel(logLevelEnum)
    configs.logLevel = val
  } else {
    // handle error
    var errorMessage = 'Unknown log level "' + val + '". Possible are: "' + Object.keys(LOG_STRING_TO_ENUM).join('", "') + '". '
    if (configs.logLevel) {
      // do not change current log level
      errorMessage += 'Log level remains "' + configs.logLevel
    } else {
      // set default log level
      var defaultVal = defaults.logLevel
      errorMessage += 'Fallback to default "' + defaultVal + '".'
      log.setLevel(LOG_STRING_TO_ENUM[defaultVal])
      configs.logLevel = defaultVal
    }
    console.error(errorMessage)
  }
}
github archilogic-com / 3dio-js / src / core / bootstrap.js View on Github external
import { name, version, homepage } from '../../package.json'
import Logger from 'js-logger'
import './polyfills.js'
import runtime from './runtime.js'

// Bootstrap logger
Logger.useDefaults()

// print header to console in browser environment
if (runtime.isBrowser) {
  console.log(homepage+' '+version+' (@'+GIT_BRANCH+' #'+GIT_COMMIT.substr(0,7)+' '+BUILD_DATE+')' )
}

// global dependencies

// three.js
if (runtime.isNode) global.THREE = require('three')
github simplygreatwork / godsend / src / Exchange.js View on Github external
connected: function(connection) { // next: now update broker and master user records (the patterns at least)
				this.connected = true;
				Logger.get('exchange').info('The secure broker exchange is now connected to the bus as a client.');
				this.connection = connection;
				callback();
			}.bind(this),
			errored : function(errors) {
github thenickdude / snap-to-s3 / lib / snap-to-s3.js View on Github external
_validateTemporaryVolume(volume, snapshot) {
		const
			logger = Logger.get(snapshot.SnapshotId),
			
			// The volume may or may not be GPG-encrypted on S3, so check for both:
			ddKeyPlaintext = createS3KeyForSnapshotVolumeImage(snapshot, true, false),
			ddKeyEncrypted = createS3KeyForSnapshotVolumeImage(snapshot, true, true);
		
		let
			isEncrypted = false;
		
		// Check if we have a dd image in S3 to validate against
		return this.s3.headObject({
			Bucket: this.options.bucket,
			Key: ddKeyPlaintext
		}).promise()
			.catch(err => {
				// Okay, look for an encrypted version instead...
				isEncrypted = true;
github thenickdude / snap-to-s3 / lib / snap-to-s3.js View on Github external
_uploadTemporaryVolume(volume, snapshot) {
		const
			logger = Logger.get(snapshot.SnapshotId),
			
			/**
			 * @type {S3.PutObjectRequest}
			 */
			s3Params = {
				Bucket: this.options.bucket,
				Metadata: {
					"snapshot-starttime": moment(snapshot.StartTime).format(), // Defaults to ISO8601
					"snapshot-snapshotid": snapshot.SnapshotId,
					"snapshot-volumesize": "" + snapshot.VolumeSize,
					"snapshot-volumeid": snapshot.VolumeId,
					"snapshot-description": snapshot.Description,
				}
			},
			
			tags = this._sanitiseSnapshotTagsForS3(snapshot.Tags);
github panarch / concerto / demo / main.js View on Github external
define(function(require, exports, module) {
    var $ = require('jquery');
    var Logger = require('js-logger');
    Logger.useDefaults();
    var L = Logger.get('main');
    var Converter = require('Converter');
    var Renderer = require('Renderer');
    var Player = require('Player');

    var musicjson;

    /*
    var examples = [
        './examples/scales.xml',
        './examples/sonata16.xml', // x
        './examples/adeste.xml',
        './examples/inv4.xml',
        './examples/inv1.xml',
        './examples/test_notations.xml',
        './examples/blank_a7.xml'
    ];
github archilogic-com / 3dio-js / src / utils / auth / activate-account.js View on Github external
export default function activateAccount (args) {

  var credentials = {
    token: args.token,
    password: args.password
  }

  log.debug('Sending account activation request...')
  return callServices('User.activateAccount', { arguments: credentials })
    .then(function onSuccess (result) {
      log.debug('Account activation request successful.')
      // update session
      return getSession().then(function(session){
        if (session.isAuthenticated) log.debug('Activated user is logged in.')
        return session
      })
    }, function onError (error) {
      log.debug('Account activation failed.', error)
      return Promise.reject(error)
    })
}
github archilogic-com / 3dio-js / src / utils / auth / sign-up.js View on Github external
}, function onSignUpError(error){

    // denied
    log.debug('API: Could not sign up using email "' + credentials.email + '".', error)
    return Promise.reject(error)

  })
github archilogic-com / 3dio-js / src / utils / auth / request-password-reset.js View on Github external
}, function onError(error){

      // denied
      log.debug('API: requesting password reset failed.', error)
      return Promise.reject(error)

    })