Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright & License details are available under JXCORE_LICENSE file
var path = require('path')
var fs = require('fs')
var log = require('npmlog')
var npm = require('./npm.js')
var autoremove_arr = null;
// for jxcore related logging
log.addLevel('jxcore', 10000, { fg: 'cyan', bg: 'black' }, 'JXcore')
var arg_useExecPath = null;
// sets multiple env variables
exports.setVariables = function() {
var cmd = process.argv[2];
if (typeof jxcore === 'undefined' || !cmd)
return;
// for shortcuts refer to deps/npm/lib/npm.js # 64
var supportedCommands = [
'install', 'i', 'isntall',
'rebuild', 'rb',
'update', 'up'
npmlog.addLevel('basic', 3000, {
fg: 'white'
}, '');
// "INFO ..."
// use to display information that describes
// the process being executed or any useful output that
// the end developer may benefit from knowing.
npmlog.addLevel('info', 3000, {
fg: 'grey'
}, 'INFO');
// "HTTP ..."
// Currently unused, but should be used to indicate
// any HTTP requests being made on behalf of the CLI
npmlog.addLevel('http', 4000, {
fg: 'grey'
}, 'HTTP');
// "WARN ..."
// Indicates potentially harmful situations
//
npmlog.addLevel('warn', 5000, {
fg: 'black',
bg: 'yellow'
}, 'WARN');
//
// "ERR! ..."
// Indicates failure
//
npmlog.addLevel('error', 6000, {
npmlog.addLevel('trace', 2000, {
fg: 'blue'
}, 'TRACE');
// " ..."
// No text prefix displayed.
// Use for lists of things.
npmlog.addLevel('basic', 3000, {
fg: 'white'
}, '');
// "INFO ..."
// use to display information that describes
// the process being executed or any useful output that
// the end developer may benefit from knowing.
npmlog.addLevel('info', 3000, {
fg: 'grey'
}, 'INFO');
// "HTTP ..."
// Currently unused, but should be used to indicate
// any HTTP requests being made on behalf of the CLI
npmlog.addLevel('http', 4000, {
fg: 'grey'
}, 'HTTP');
// "WARN ..."
// Indicates potentially harmful situations
//
npmlog.addLevel('warn', 5000, {
fg: 'black',
bg: 'yellow'
configureLogging() {
const { loglevel } = this.options;
if (loglevel) {
log.level = loglevel;
}
// handle log.success()
log.addLevel("success", 3001, { fg: "green", bold: true });
// create logger that subclasses use
this.logger = log.newGroup(this.name);
// emit all buffered logs at configured level and higher
log.resume();
}
fg: 'grey'
}, 'HTTP');
// "WARN ..."
// Indicates potentially harmful situations
//
npmlog.addLevel('warn', 5000, {
fg: 'black',
bg: 'yellow'
}, 'WARN');
//
// "ERR! ..."
// Indicates failure
//
npmlog.addLevel('error', 6000, {
fg: 'red',
bg: 'black'
}, 'ERR!');
npmlog.level = 'basic';
Object.defineProperty(npmlog, 'heading', {
set(value) { // jshint ignore:line
// This strange code is necessary to prevent
// node-pre-gyp from setting the npmlog.heading
// property.
//
// There exists a rare case in ./lib/usb-connection.js
// where a third party dependency (usb) is loaded _after_ the
// internal dependencies.
//
*
* @const {string}
*/
logger.NO_CLIENT_ID = '*';
npmlog.addLevel('all', -Infinity, styles.inverse, 'all ');
npmlog.addLevel('proton_data', -Infinity, styles.green, 'data ');
npmlog.addLevel('proton_exit', -Infinity, styles.yellow, 'exit ');
npmlog.addLevel('proton_entry', -Infinity, styles.yellow, 'entry ');
npmlog.addLevel('proton', -Infinity, styles.yellow, 'func ');
npmlog.addLevel('data_often', 100, styles.green, 'data ');
npmlog.addLevel('exit_often', 100, styles.yellow, 'exit ');
npmlog.addLevel('entry_often', 100, styles.yellow, 'entry ');
npmlog.addLevel('often', 100, styles.yellow, 'func ');
npmlog.addLevel('raw', 200, styles.inverse, 'raw ');
npmlog.addLevel('detail', 300, styles.green, 'detail');
npmlog.addLevel('debug', 500, styles.inverse, 'debug ');
npmlog.addLevel('emit', 800, styles.green, 'emit ');
npmlog.addLevel('data', 1000, styles.green, 'data ');
npmlog.addLevel('parms', 1200, styles.yellow, 'parms ');
npmlog.addLevel('header', 1500, styles.yellow, 'header');
npmlog.addLevel('exit', 1500, styles.yellow, 'exit ');
npmlog.addLevel('entry', 1500, styles.yellow, 'entry ');
npmlog.addLevel('entry_exit', 1500, styles.yellow, 'func ');
npmlog.addLevel('error', 1800, styles.red, 'error ');
npmlog.addLevel('object', 1900, styles.red, 'object');
npmlog.addLevel('ffdc', 2000, styles.red, 'ffdc ');
/**
* Set the logging stream. By default stderr will be used, but
* this can be changed to stdout by setting the environment
function createLogger (name: string, level: number, style: StyleObject): (...args: Array) => void {
const loggerName = `tractor-${name}`;
addLevel(loggerName, level, style, name);
return function (message: string, ...args: Array): void {
log(loggerName, '', message, ...args);
};
}
/**
* The identifier used when a log entry is not associated with a
* particular client.
*
* @const {string}
*/
logger.NO_CLIENT_ID = '*';
npmlog.addLevel('all', -Infinity, styles.inverse, 'all ');
npmlog.addLevel('proton_data', -Infinity, styles.green, 'data ');
npmlog.addLevel('proton_exit', -Infinity, styles.yellow, 'exit ');
npmlog.addLevel('proton_entry', -Infinity, styles.yellow, 'entry ');
npmlog.addLevel('proton', -Infinity, styles.yellow, 'func ');
npmlog.addLevel('data_often', 100, styles.green, 'data ');
npmlog.addLevel('exit_often', 100, styles.yellow, 'exit ');
npmlog.addLevel('entry_often', 100, styles.yellow, 'entry ');
npmlog.addLevel('often', 100, styles.yellow, 'func ');
npmlog.addLevel('raw', 200, styles.inverse, 'raw ');
npmlog.addLevel('detail', 300, styles.green, 'detail');
npmlog.addLevel('debug', 500, styles.inverse, 'debug ');
npmlog.addLevel('emit', 800, styles.green, 'emit ');
npmlog.addLevel('data', 1000, styles.green, 'data ');
npmlog.addLevel('parms', 1200, styles.yellow, 'parms ');
npmlog.addLevel('header', 1500, styles.yellow, 'header');
npmlog.addLevel('exit', 1500, styles.yellow, 'exit ');
npmlog.addLevel('entry', 1500, styles.yellow, 'entry ');
npmlog.addLevel('entry_exit', 1500, styles.yellow, 'func ');
npmlog.addLevel('error', 1800, styles.red, 'error ');
npmlog.addLevel('object', 1900, styles.red, 'object');
npmlog.addLevel('ffdc', 2000, styles.red, 'ffdc ');
npmlog.addLevel('data_often', 100, styles.green, 'data ');
npmlog.addLevel('exit_often', 100, styles.yellow, 'exit ');
npmlog.addLevel('entry_often', 100, styles.yellow, 'entry ');
npmlog.addLevel('often', 100, styles.yellow, 'func ');
npmlog.addLevel('raw', 200, styles.inverse, 'raw ');
npmlog.addLevel('detail', 300, styles.green, 'detail');
npmlog.addLevel('debug', 500, styles.inverse, 'debug ');
npmlog.addLevel('emit', 800, styles.green, 'emit ');
npmlog.addLevel('data', 1000, styles.green, 'data ');
npmlog.addLevel('parms', 1200, styles.yellow, 'parms ');
npmlog.addLevel('header', 1500, styles.yellow, 'header');
npmlog.addLevel('exit', 1500, styles.yellow, 'exit ');
npmlog.addLevel('entry', 1500, styles.yellow, 'entry ');
npmlog.addLevel('entry_exit', 1500, styles.yellow, 'func ');
npmlog.addLevel('error', 1800, styles.red, 'error ');
npmlog.addLevel('object', 1900, styles.red, 'object');
npmlog.addLevel('ffdc', 2000, styles.red, 'ffdc ');
/**
* Set the logging stream. By default stderr will be used, but
* this can be changed to stdout by setting the environment
* variable MQLIGHT_NODE_LOG_STREAM=stdout.
*/
logger.setStream(process.env.MQLIGHT_NODE_LOG_STREAM || 'stderr');
/**
* Set the amount of message data that will get logged. The
* default is 100 bytes, but this can be altered by setting the
* environment variable MQLIGHT_NODE_MESSAGE_DATA_SIZE to a
* different number.
logger.NO_CLIENT_ID = '*';
npmlog.addLevel('all', -Infinity, styles.inverse, 'all ');
npmlog.addLevel('proton_data', -Infinity, styles.green, 'data ');
npmlog.addLevel('proton_exit', -Infinity, styles.yellow, 'exit ');
npmlog.addLevel('proton_entry', -Infinity, styles.yellow, 'entry ');
npmlog.addLevel('proton', -Infinity, styles.yellow, 'func ');
npmlog.addLevel('data_often', 100, styles.green, 'data ');
npmlog.addLevel('exit_often', 100, styles.yellow, 'exit ');
npmlog.addLevel('entry_often', 100, styles.yellow, 'entry ');
npmlog.addLevel('often', 100, styles.yellow, 'func ');
npmlog.addLevel('raw', 200, styles.inverse, 'raw ');
npmlog.addLevel('detail', 300, styles.green, 'detail');
npmlog.addLevel('debug', 500, styles.inverse, 'debug ');
npmlog.addLevel('emit', 800, styles.green, 'emit ');
npmlog.addLevel('data', 1000, styles.green, 'data ');
npmlog.addLevel('parms', 1200, styles.yellow, 'parms ');
npmlog.addLevel('header', 1500, styles.yellow, 'header');
npmlog.addLevel('exit', 1500, styles.yellow, 'exit ');
npmlog.addLevel('entry', 1500, styles.yellow, 'entry ');
npmlog.addLevel('entry_exit', 1500, styles.yellow, 'func ');
npmlog.addLevel('error', 1800, styles.red, 'error ');
npmlog.addLevel('object', 1900, styles.red, 'object');
npmlog.addLevel('ffdc', 2000, styles.red, 'ffdc ');
/**
* Set the logging stream. By default stderr will be used, but
* this can be changed to stdout by setting the environment
* variable MQLIGHT_NODE_LOG_STREAM=stdout.
*/
logger.setStream(process.env.MQLIGHT_NODE_LOG_STREAM || 'stderr');