Exemplo n.º 1
0
// these functions are to be run from within the jest context
// (ie with describe() and friends globally defined already.)

// args: {
//   csl: string path to a CSL file,
//   jurisdictionDirs: array of string paths to jurisdiction directories
//   libraries: array of string paths to exported CSL-JSON libraries,
//   suites: array of string paths to YAML test suites
// }
function jestCSL(args) {
  if (typeof jest === 'undefined') {
    return;
  }
  log.setLevel('silent');
  let units = readTestUnits(args.suites);
  let engine = new TestEngine(args);

  units.forEach(unit => {
    describe(unit.describe, () => {
      if (unit.tests) {
        unit.tests.forEach(test => {
          let run = () => {
            jestTestCase(engine, test);
          }
          // mode: skip | only (not doc)
          let mode = test.mode === 'known' ? 'skip' : test.mode;
          if (test.mode && it[mode]) {
            it[mode](test.it, run);
          } else {
            if (test.expect) {
              it(test.it, run)
            } else {
              // it.skip(test.it, run); // stub
            }
          }
        })
      }
    })
  });
}
Exemplo n.º 2
0
function Model(gameData) {
    log.setLevel(gameData.logLevel || 'warn');

    this.playerArrows = new arrows.PlayerArrows(gameData.totalPlayers);
    this.playerScores = new scores.PlayerScores(gameData.totalPlayers);
    this.lastUpdate = 0;
    this.spawningStrategy = gameData.initialSpawning || spawning.standard();
    this.critters = [];
    this.level = gameData.level;
    this.playerId = gameData.playerId;
    this.totalPlayers = gameData.totalPlayers;
    this.isRunning = true;

    this.update = function updateModel(gameTime) {
        if (gameTime >= gameData.totalTime) {
            this.isRunning = false;
            gameTime = gameData.totalTime;
        }

        if (Math.floor(gameTime / TICK_INTERVAL) > Math.floor(this.lastUpdate / TICK_INTERVAL)) {
            var nextTick = this.lastUpdate + TICK_INTERVAL - (this.lastUpdate % TICK_INTERVAL);
            for (var time = nextTick; time <= gameTime; time += TICK_INTERVAL) {
                updateCritters(this, time);
                this.spawningStrategy.rabbits(this, time, gameData.random);
                this.spawningStrategy.foxes(this, time, gameData.random);
                this.playerScores.save(time / TICK_INTERVAL);
            }

            this.lastUpdate = gameTime;
        }
    };
}
Exemplo n.º 3
0
	level  : function ( lvl ) {
		if ( lvl.toLowerCase() === "none" ) {
			log.disableAll();
		} else {
			log.setLevel( lvl );
		}
	},
Exemplo n.º 4
0
ClosureBuilder.prototype.setLogLevel = function(loglevel) {
  if (this.logLevel !== loglevel) {
    this.logLevel = loglevel;
    log.warn('Set loglevel to', loglevel);
    log.setLevel(loglevel);
  }
};
Exemplo n.º 5
0
	exports.init = function init(callback) {
		log.setLevel(0);
		log.debug('\'Allo \'Allo');
		log.debug('Running jQuery:', $().jquery);
		log.debug('Running Bootstrap:',!!$.fn.scrollspy? '~3.3.0' : false);

		// Run callback as last
		callback(document.location.pathname);
	};
Exemplo n.º 6
0
export default async function startup (appComponent, reducer, {i18nNS} = {}) {
  log.setLevel(global.siteConfig.logLevel)
  log.info(`Log level set to ${global.siteConfig.logLevel}`)
  log.info('INIT: Starting app setup...')

  initStuffrApi()

  // Activate Redux dev tools if installed in browser
  // https://github.com/zalmoxisus/redux-devtools-extension
  const devToolComposer = global.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
    ? global.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : redux.compose
  const reduxLogger = createLogger({collapsed: true})
  const store = redux.createStore(reducer, devToolComposer(
    redux.applyMiddleware(thunk, reduxLogger)
  ))

  // Load translation data if a namespace was specified
  if (i18nNS) {
    try {
      await i18nSetup({loadPath: 'locales/{{ns}}/{{lng}}.json'}, i18nNS)
      log.info(`Successfully loaded locale en:${i18nNS}`)
    } catch (e) {
      log.error(`Error loading i18n: ${e}`)
      throw e
    }
  }

  const appElement = document.getElementById('app')
  function rerender () {
    ReactDOM.render(
      // Provider: Used to provide access to the Redux store in components
      // AppContainer: Used for hot module reloading
      <Provider store={store}>
        <AppContainer>
          {appComponent}
        </AppContainer>
      </Provider>,
      appElement)
  }
  rerender()

  // Set up HMR for dev server for common code
  if (module.hot) {
    // TODO: Test API reinitialization
    module.hot.accept('../stuffrapi', initStuffrApi)
  }

  log.info('INIT: App setup complete')
  return {store, rerender}
}
Exemplo n.º 7
0
	var prepareOptions = function(inputOptions){
		_.merge(this.options, inputOptions || {});

		if(typeof this.options.verbosity === "string"){
			var verbosityLevel = this.options.verbosity;

			this.options.verbosity = {
				level: verbosityLevel,
				urlTracing: true
			}
		}

		log.setLevel(this.options.verbosity.level);
	}.bind(this);
Exemplo n.º 8
0
        init: function init() {
            log.setLevel(0);
            log.debug('Running jQuery %s', $().jquery);

            log.debug('');
            log.debug('Initializing components ...');

            for (var key in components) {
                try {
                    components[key].init();
                } catch (err) {
                    log.debug('initialization failed for component \'' + key + '\'');
                    log.error(err);
                }
            }
        }
Exemplo n.º 9
0
module.exports = function ({ level, logger }) {
  const levels = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
  const log = require('loglevel');

  level = level || 'warn';
  if (levels.indexOf(level) === -1) { console.error('invalid log level: %s', level); }
  log.setLevel(level);
  // if logger passed in, call logger functions instead of our loglevel functions
  if (logger != null) {
    levels.forEach((level) => {
      if (typeof logger[level] === 'function') {
        log[level] = (...args) => { logger[level](...args); };
      }
    });
  }

  return log;
};
Exemplo n.º 10
0
Arquivo: index.js Projeto: Kackey/felt
module.exports = function(...configs) {
  const opts = configBuilder(...configs)

  const loglevel = opts.debug ? log.levels.DEBUG : log.levels.ERROR
  log.setLevel(loglevel, false)

  co(function* () {
    if (opts.refresh) {
      yield refresh(opts)
      log.debug('Refreshing completed!')
    }
    if (opts.watch) {
      watch(opts)
      log.debug('Watching started!')
    }
  })

  return handler(opts)
}
Exemplo n.º 11
0
define(function (require, exports, module) {
    "use strict";

    var loglevel = require("loglevel");

    /*eslint no-console:0*/

    if (__PG_DEBUG__) {
        // If the debug global is set, log messages at and below debug level
        loglevel.enableAll();

        if (!loglevel.hasOwnProperty("table")) {
            loglevel.table = console.table.bind(console);
        }
    } else {
        // Otherwise, only log information, warnings and errors
        loglevel.setLevel(loglevel.levels.INFO);
    }
    
    ["timeStamp", "group", "groupCollapsed", "groupEnd", "trace"].forEach(function (api) {
        if (!loglevel.hasOwnProperty(api)) {
            loglevel[api] = console[api].bind(console);
        }
    });
    
    /**
     * Return the time (in ms) elapsed since page load.
     * 
     * @return {Number}
     */
    loglevel.timeElapsed = function () {
        return Date.now() - performance.timing.domLoading;
    };

    module.exports = loglevel;
});
Exemplo n.º 12
0
             .option('-c, --crosswalk', 'enable Crosswalk for Android', false)
             .option('-w, --webAppToolkit', 'adds the Web App Toolkit cordova plugin', false)
             .parse(process.argv);

if (!process.argv.slice(2).length) {
  program.help();
}

var validationResult = checkParameters(program);
if (validationResult) {
  console.log(validationResult);
  process.exit(1);
}

global.logLevel = program.loglevel;
log.setLevel(global.logLevel);

if (program.run) {
  // Run the app for the specified platform

  var platform = program.args[1];
  projectTools.runApp(platform, function (err) {
    if (err) {
      log.error('ERROR: ' + err.message);
    }
  });

} else if (program.visualstudio) {

  projectTools.openVisualStudio(function (err) {
    if (err) {
// Load config vars
if (process.env.NODE_ENV !== 'production') require('dotenv').load();
var log = require('loglevel');
log.setLevel(process.env.LOG_LEVEL || 'debug');
log.info('Log level set to', process.env.LOG_LEVEL);

// Web server dependencies
var http = require('http');
var express = require('express');
var app = express();
var path = require('path');

// Collaborative coding dependencies
var WebSocketServer = require("ws").Server;
var gulf = require('gulf');
var textOT = require('ot-text').type;

// WebRTC video/audio dependencies
var AccessToken = require('twilio').AccessToken;
var ConversationsGrant = AccessToken.ConversationsGrant;

/*
 *
 * Use an in-memory document store
 * i.e. documents are lost when server is restarted
 * TODO: change document store to redis or mongo some other persistent DB
 *
 *
 */
var documents = {};
Exemplo n.º 14
0
var logger = new Logger();

var q = require('q');
var loglevelLog = require('loglevel');

// todo: -Dlog.leve=trace
loglevelLog.setLevel(loglevelLog.levels.TRACE)

var stackTrace = require('stack-trace');

function Logger() {

    var testLog = [];

    this.testLog = function() {
        return testLog;
    };

    this.resetTestLog = function() {
        testLog = [];
    };

    this.trace = function(message, showStack) {

        log("trace",message,false);
    };

    this.debug = function(message, showStack) {

        log("debug",message,showStack);
exports.set_loglevel = function(level) {
    const FN = '[' + NS + '.set_loglevel' + ']';

    log.setLevel(level);
};
Exemplo n.º 16
0
'use strict';

import * as log from 'loglevel';
import Draggabilly from 'Draggabilly';

log.setLevel(APP_LOGLEVEL);
const logger = log.getLogger('index');

require('./assets/style/root.css');

const imgGnu = require('./assets/img/zoro.png');
const root = document.getElementById('root');

logger.debug('app started');

root.innerHTML = `
<strong>Webpack2</strong> tests <br>
Production: ${APP_PRODUCTION} <br>

begin<br>

<p id="t1"></p>

end<br>

<img src='${imgGnu}' class='test'>
`;

const elem = document.querySelector('.test');
const draggable = new Draggabilly( elem);
draggable.on('dragEnd', (evt) => {
Exemplo n.º 17
0
    constructor(config_source, options) {
        options = options || {};
        subscribeMixin(this);

        this.initialized = false;
        this.initializing = false;
        this.sources = {};

        this.tile_manager = TileManager;
        this.tile_manager.init(this);
        this.num_workers = options.numWorkers || 2;
        this.continuous_zoom = (typeof options.continuousZoom === 'boolean') ? options.continuousZoom : true;
        this.tile_simplification_level = 0; // level-of-detail downsampling to apply to tile loading
        this.allow_cross_domain_workers = (options.allowCrossDomainWorkers === false ? false : true);
        this.worker_url = options.workerUrl;
        if (options.disableVertexArrayObjects === true) {
            VertexArrayObject.disabled = true;
        }

        Utils.use_high_density_display = options.highDensityDisplay !== undefined ? options.highDensityDisplay : true;
        Utils.updateDevicePixelRatio();

        this.config = null;
        this.config_source = config_source;
        this.config_serialized = null;

        this.styles = null;
        this.active_styles = {};

        this.building = null;                           // tracks current scene building state (tiles being built, etc.)
        this.dirty = true;                              // request a redraw
        this.animated = false;                          // request redraw every frame
        this.preUpdate = options.preUpdate;             // optional pre-render loop hook
        this.postUpdate = options.postUpdate;           // optional post-render loop hook
        this.render_loop = !options.disableRenderLoop;  // disable render loop - app will have to manually call Scene.render() per frame
        this.frame = 0;
        this.resetTime();

        this.zoom = null;
        this.center = null;

        this.zooming = false;
        this.preserve_tiles_within_zoom = 1;
        this.panning = false;
        this.container = options.container;

        this.camera = null;
        this.lights = null;
        this.background = null;

        // Model-view matrices
        // 64-bit versions are for CPU calcuations
        // 32-bit versions are downsampled and sent to GPU
        this.modelMatrix = new Float64Array(16);
        this.modelMatrix32 = new Float32Array(16);
        this.modelViewMatrix = new Float64Array(16);
        this.modelViewMatrix32 = new Float32Array(16);
        this.normalMatrix = new Float64Array(9);
        this.normalMatrix32 = new Float32Array(9);

        this.selection = null;
        this.texture_listener = null;

        // Debug config
        this.debug = {
            profile: {
                geometry_build: false
            }
        };

        this.initialized = false;
        this.initializing = false;
        this.updating = 0;
        this.generation = 0; // an id that is incremented each time the scene config is invalidated

        this.logLevel = options.logLevel || 'warn';
        log.setLevel(this.logLevel);
    }
Exemplo n.º 18
0
import Home from './components/pages/home.jsx';
import MovieStore from './stores/movie-store';
import TodoStore from './stores/todo-store';

// function getParameterByName(name) {
//     name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
//     var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
//         results = regex.exec(location.search);
//     return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
// }

// const webSocket = new WebSocket('ws://192.168.1.115:8000/');
// const isSlave = getParameterByName('slave');

Log.setLevel(Log.levels.TRACE);
const app = new App('app', [MovieStore, TodoStore]);

// if (isSlave) {
//   console.log("is slave")
//   webSocket.onmessage = (event) => {
//     console.log("recevsiing data", event)
//     const diffs = JSON.parse(event.data);
//     app.applyImmutableDiffs(Immutable.fromJS(diffs));
//   };
// } else {
//   console.log("is master")
//   app.addDiffListener((diffs) => {
//     const data = JSON.stringify(diffs);
//     console.log("sending data", data);
//     webSocket.send(data);
Exemplo n.º 19
0
  }
});

if (errors.length) {
  errors.forEach(function(error) {
    $.util.log(error);
  });
  process.exit(1);
}

var logLevel = log.levels.DEBUG;
if (process.env.LOG_LEVEL) {
  logLevel = parseInt(process.env.LOG_LEVEL);
}

log.setLevel(logLevel);
$.util.log("Log level is " + log.getLevel());

var uri = new URI(process.env.SERVER_URL);
var subdomain = uri.subdomain();
var domain;

if (subdomain) {
  domain = subdomain + "." + uri.domain();
} else {
  domain = uri.domain();
}

$.util.log("Domain " + domain);

function execAsync(cmd, options) {
Exemplo n.º 20
0
/**
 * @callback optionsCallback
 * @param error
 * @param options augmented options
 */

/**
 * Extracts only desired keys from inpOptions and augments it with defaults
 * @param inpOptions
 * @param {optionsCallback} callback
 */
function optionsFactory(inpOptions, callback) {

    const options = {
        dir: PLACEHOLDER_APP_DIR,
        name: inpOptions.name,
        targetUrl: normalizeUrl(inpOptions.targetUrl),
        platform: inpOptions.platform || inferPlatform(),
        arch: inpOptions.arch || inferArch(),
        version: inpOptions.electronVersion || ELECTRON_VERSION,
        nativefierVersion: packageJson.version,
        out: inpOptions.out || process.cwd(),
        overwrite: inpOptions.overwrite,
        asar: inpOptions.conceal || false,
        icon: inpOptions.icon,
        counter: inpOptions.counter || false,
        width: inpOptions.width || 1280,
        height: inpOptions.height || 800,
        showMenuBar: inpOptions.showMenuBar || false,
        fastQuit: inpOptions.fastQuit || false,
        userAgent: inpOptions.userAgent,
        ignoreCertificate: inpOptions.ignoreCertificate || false,
        insecure: inpOptions.insecure || false,
        flashPluginDir: inpOptions.flashPath || inpOptions.flash || null,
        inject: inpOptions.inject || null,
        ignore: 'src',
        fullScreen: inpOptions.fullScreen || false,
        maximize: inpOptions.maximize || false,
        hideWindowFrame: inpOptions.hideWindowFrame,
        verbose: inpOptions.verbose,
        disableContextMenu: inpOptions.disableContextMenu
    };

    if (options.verbose) {
        log.setLevel('trace');
    } else {
        log.setLevel('error');
    }

    if (options.flashPluginDir) {
        options.insecure = true;
    }

    if (inpOptions.honest) {
        options.userAgent = null;
    }

    if (options.platform.toLowerCase() === 'windows') {
        options.platform = 'win32';
    }

    if (options.platform.toLowerCase() === 'osx' || options.platform.toLowerCase() === 'mac') {
        options.platform = 'darwin';
    }

    async.waterfall([
        callback => {
            if (options.userAgent) {
                callback();
                return;
            }
            inferUserAgent(options.version, options.platform)
                .then(userAgent => {
                    options.userAgent = userAgent;
                    callback();
                })
                .catch(callback);
        },
        callback => {
            if (options.icon) {
                callback();
                return;
            }
            inferIcon(options.targetUrl, options.platform)
                .then(pngPath => {
                    options.icon = pngPath;
                    callback();
                })
                .catch(error => {
                    log.warn('Cannot automatically retrieve the app icon:', error);
                    callback();
                });
        },
        callback => {
            // length also checks if its the commanderJS function or a string
            if (options.name && options.name.length > 0) {
                callback();
                return;
            }

            inferTitle(options.targetUrl, function(error, pageTitle) {
                if (error) {
                    log.warn(`Unable to automatically determine app name, falling back to '${DEFAULT_APP_NAME}'`);
                    options.name = DEFAULT_APP_NAME;
                } else {
                    options.name = pageTitle.trim();
                }
                if (options.platform === 'linux') {
                    // spaces will cause problems with Ubuntu when pinned to the dock
                    options.name = _.kebabCase(options.name);
                }
                callback();
            });
        }
    ], error => {
        callback(error, sanitizeOptions(options));
    });
}
Exemplo n.º 21
0
Arquivo: rm.js Projeto: ledif/dimebox
  handler: (argv) => {
    guard()
    log.setLevel(argv.v ? 'debug' : 'info')

    rm(argv.epoch)
  }
Exemplo n.º 22
0
var Config = require('/lib/config')
var TransactionService = require('/transaction/transaction_service.js')

var config = {
  config: {isInstalled: true, debug: true},
  init: function () { this.setConfig({isInstalled: true, debug: true}) },
  '@runtimeGlobal': true
}

Object.setPrototypeOf(config, Config)

config.init()
var logger = require('loglevel')
logger.setLevel('debug', false)
var transactionService = new TransactionService(zone, logger)

function $animatePatch ($provide, traceBuffer) {
  $provide.decorator('$animate', ['$delegate', function ($delegate) {
    var _enter = $delegate.enter
    $delegate.enter = function () {
      console.log('animation started')
      var t = traceBuffer.startTrace('$animate.enter', '$animate')
      var result = _enter.apply(this, arguments)
      function animationEnded () {
        console.log('animation ended')
        t.end()
      }
      result.then(animationEnded, animationEnded)
      return result
    }
    return $delegate
Exemplo n.º 23
0
var log = require('loglevel'),
  minimist = require('minimist');

var argv = minimist(process.argv, {
  'default': {
      'debug': false,
      'log': 'info'
    }, 'boolean': true
}) || [];

var debug = process.env['chimp.debug'] === 'true' ? true :
  process.env['chimp.debug'] === 'false' ? false :
  process.env['chimp.debug'] || argv.debug;

if (debug) {
  log.setLevel('debug');
} else {
  log.setLevel(argv.log);
}
module.exports = log;
Exemplo n.º 24
0
 componentDidMount () {
   const state = bk.getState()
   this.setState(state)
   bk.subscribe(this.update.bind(this))
   log.setLevel(this.state.log)
 }
Exemplo n.º 25
0
var express = require('express'),
  cfenv = require('cfenv'),
  log = require('loglevel')

log.setLevel('info')

var app = express()
require('./routes')(app)

var server = app.listen(cfenv.getAppEnv().port, function () {
  var host = server.address().address
  var port = server.address().port

  log.info('Example app listening at http://%s:%s', host, port)

})
Exemplo n.º 26
0
 this.setState({ [name]: value }, () => {
   log.setLevel(this.state.log || 'silent')
 })
Exemplo n.º 27
0
function setLogLevel (n) {
  logLevel = n || logLevel;
  ll.setLevel(logLevel);
}
Exemplo n.º 28
0
    constructor(config_source, options) {
        options = options || {};
        subscribeMixin(this);

        this.initialized = false;
        this.initializing = null; // will be a promise that resolves when scene is loaded
        this.sources = {};

        this.view = new View(this, options);
        this.tile_manager = TileManager;
        this.tile_manager.init({ scene: this, view: this.view });
        this.num_workers = options.numWorkers || 2;
        this.allow_cross_domain_workers = (options.allowCrossDomainWorkers === false ? false : true);
        this.worker_url = options.workerUrl;
        if (options.disableVertexArrayObjects === true) {
            VertexArrayObject.disabled = true;
        }

        Utils.use_high_density_display = options.highDensityDisplay !== undefined ? options.highDensityDisplay : true;
        Utils.updateDevicePixelRatio();

        this.config = null;
        this.config_source = config_source;
        this.config_serialized = null;
        this.last_valid_config_source = null;

        this.styles = null;
        this.active_styles = {};

        this.building = null;                           // tracks current scene building state (tiles being built, etc.)
        this.dirty = true;                              // request a redraw
        this.animated = false;                          // request redraw every frame
        this.preUpdate = options.preUpdate;             // optional pre-render loop hook
        this.postUpdate = options.postUpdate;           // optional post-render loop hook
        this.render_loop = !options.disableRenderLoop;  // disable render loop - app will have to manually call Scene.render() per frame
        this.render_loop_active = false;
        this.render_loop_stop = false;
        this.render_count = 0;
        this.last_render_count = 0;
        this.render_count_changed = false;
        this.frame = 0;
        this.queue_screenshot = null;
        this.selection = null;
        this.resetTime();

        this.container = options.container;

        this.lights = null;
        this.background = null;

        // Listen to related objects
        this.listeners = {
            view: {
                move: () => this.trigger('move')
            }
        };
        this.view.subscribe(this.listeners.view);

        this.updating = 0;
        this.generation = 0; // an id that is incremented each time the scene config is invalidated
        this.last_complete_generation = 0; // last generation id with a complete view
        this.setupDebug();

        this.logLevel = options.logLevel || 'warn';
        log.setLevel(this.logLevel);
    }
Exemplo n.º 29
0
const h = require('react-hyperscript')
const Root = require('../ui/app/root')
const configureStore = require('../ui/app/store')
const actions = require('../ui/app/actions')
const states = require('./states')
const backGroundConnectionModifiers = require('./backGroundConnectionModifiers')
const Selector = require('./selector')
const MetamaskController = require('../app/scripts/metamask-controller')
const firstTimeState = require('../app/scripts/first-time-state')
const ExtensionPlatform = require('../app/scripts/platforms/extension')
const extension = require('./mockExtension')
const noop = function () {}

const log = require('loglevel')
window.log = log
log.setLevel('debug')

//
// Query String
//

const qs = require('qs')
const routerPath = window.location.href.split('#')[1]
let queryString = {}
let selectedView

if (routerPath) {
  queryString = qs.parse(routerPath.split('?')[1])
}

selectedView = queryString.view || 'first time'
Exemplo n.º 30
0
var DxfArrayScanner = require('./DxfArrayScanner.js'),
	AUTO_CAD_COLOR_INDEX = require('./AutoCadColorIndex');

var log = require('loglevel');

//log.setLevel('trace');
//log.setLevel('debug');
//log.setLevel('info');
//log.setLevel('warn');
log.setLevel('error');
//log.setLevel('silent');


function DxfParser(stream) {}

DxfParser.prototype.parse = function(source, done) {
	throw new Error("read() not implemented. Use readSync()");
};

DxfParser.prototype.parseSync = function(source) {
	if(typeof(source) === 'string') {
		return this._parse(source);
	}else {
		console.error('Cannot read dxf source of type `' + typeof(source));
		return null;
	}
};

DxfParser.prototype.parseStream = function(stream, done) {

	var dxfString = "";