How to use fancy-log - 10 common examples

To help you get started, we’ve selected a few fancy-log 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 appium / appium-xcuitest-driver / ci / upload-appium.js View on Github external
gulp.task('upload', function () {
  let tempDir;
  // Find the latest bundle
  log.info('Retrieving asset and uploading to Sauce Storage');
  return support.tempDir.openDir()
    .then(function (dir) {
      log.info(`Temporary directory for download: '${dir}'`);
      tempDir = dir;
    })
    .then(function () {
      return octokit.repos.getLatestRelease({owner, repo});
    })
    .then(function (res) {
      // go through the assets and fine the correct one
      for (const asset of res.data.assets) {
        if (ASSET_NAME_REGEXP.test(asset.name)) {
          log.info(`Downloading asset from '${asset.browser_download_url}'`);
          return asset.browser_download_url;
        }
      }
github olefredrik / FoundationPress / gulpfile.babel.js View on Github external
if (checkFileExists('config.yml')) {
    // config.yml exists, load it
    log(colors.bold(colors.cyan('config.yml')), 'exists, loading', colors.bold(colors.cyan('config.yml')));
    let ymlFile = fs.readFileSync('config.yml', 'utf8');
    return yaml.load(ymlFile);

  } else if(checkFileExists('config-default.yml')) {
    // config-default.yml exists, load it
    log(colors.bold(colors.cyan('config.yml')), 'does not exist, loading', colors.bold(colors.cyan('config-default.yml')));
    let ymlFile = fs.readFileSync('config-default.yml', 'utf8');
    return yaml.load(ymlFile);

  } else {
    // Exit if config.yml & config-default.yml do not exist
    log('Exiting process, no config file exists.');
    log('Error Code:', err.code);
    process.exit(1);
  }
}
github angeloanan / MPC-DiscordRPC / index.js View on Github external
mediaEmitter.on('CONN_ERROR', code => {
	log.error(`ERROR: Unable to connect to Media Player Classic on port ${config.port}. ` +
		`Make sure MPC is running, Web Interface is enabled and the port set in 'config.js' file is correct.\n` + code);
	// If MPC was previously connected (ie. MPC gets closed while script is running)
	// the whole process is killed and restarted by Forever in order to clean MPC Rich Presence
	// from user's profile, as destroyRPC() apparently can't do so.
	if (active) {
		log.warn('WARN: Killing process to clean Rich Presence from your profile...');
		process.exit(0);
	}
	if (mpcServerLoop._onTimeout !== checkMPCEndpoint) {
		clearInterval(mpcServerLoop);
		mpcServerLoop = setInterval(checkMPCEndpoint, 15000);
	}
});
github angeloanan / MPC-DiscordRPC / index.js View on Github external
mediaEmitter.on('CONN_ERROR', code => {
	log.error(`ERROR: Unable to connect to Media Player Classic on port ${config.port}. ` +
		`Make sure MPC is running, Web Interface is enabled and the port set in 'config.js' file is correct.\n` + code);
	// If MPC was previously connected (ie. MPC gets closed while script is running)
	// the whole process is killed and restarted by Forever in order to clean MPC Rich Presence
	// from user's profile, as destroyRPC() apparently can't do so.
	if (active) {
		log.warn('WARN: Killing process to clean Rich Presence from your profile...');
		process.exit(0);
	}
	if (mpcServerLoop._onTimeout !== checkMPCEndpoint) {
		clearInterval(mpcServerLoop);
		mpcServerLoop = setInterval(checkMPCEndpoint, 15000);
	}
});
github appium / appium-chromedriver / install-npm.js View on Github external
fs.stat(BUILD_PATH, function installScriptExists (err) {
      if (err) {
        // this should only happen on local install
        log.warn(`NOTE: Run 'npx gulp transpile' before using`);
        return;
      }
      require(BUILD_PATH).doInstall().catch(function installError (err) {
        log.error(`Error installing Chromedriver: ${err.message}`);
        log.error(err.stack ? err.stack : err);
        log.error(`Downloading Chromedriver can be skipped by using the ` +
                  `'--chromedriver-skip-install' flag or ` +
                  `setting the 'APPIUM_SKIP_CHROMEDRIVER_INSTALL' environment ` +
                  `variable.`);
        process.exit(1);
      });
    });
  });
github admc / wd / gulpfile.js View on Github external
args.browsers = (args.browser || 'chrome').split(',');
args.sauce = args.sauce ? true : false;

var BROWSERS = ['chrome', 'firefox'];
if (args.sauce) { BROWSERS.push('explorer'); }

var MOBILE_BROWSERS = ['android', 'ios', 'iphone', 'ipad', 'android_phone'];

process.env.SAUCE_CONNECT_VERSION = process.env.SAUCE_CONNECT_VERSION || '4.5.1';
process.env.SAUCE_CONNECT_VERBOSE = false;

var PROXY_PORT = 5050;
var expressPort = 3000; // incremented after each test to avoid collision

var debugLog = log.bind(log);
var warnLog = log.warn.bind(log);
var errorLog = log.error.bind(log);

function buildMochaOpts(opts) {
  var mochaOpts = {
    flags: {
      u: 'bdd-with-opts',
      R: 'spec',
      c: true,
    },
    exit: true,
    bin: path.join(__dirname,  'node_modules/.bin/' + ((process.platform !== "win32") ? 'mocha' : 'mocha.cmd')),
    concurrency: args.concurrency | process.env.CONCURRENCY || 3
  };
  if(args.grep) {
    mochaOpts.flags.g = args.grep;
github vispy / vispy.js / gulpfile.js View on Github external
function rebundle(file) {
    if (file) {
        log('Rebundling,', path.basename(file[0]), 'has changes.');
    }

    return this.bundle()
        .on('error', log.bind(log, 'Browserify Error'))         // log errors if they happen
        .pipe(source(outfile))
        .pipe(buffer())
        .pipe(gulp.dest(outdir)) //generate the non-minified
        .pipe(rename({extname:'.min.js'}))
        .pipe(sourcemaps.init({loadMaps:true, debug:true}))             // init source map
        .pipe(uglify())
        .pipe(sourcemaps.write('./'))
        .pipe(gulp.dest(outdir));
}
github climatescope / climatescope.org / gulpfile.js View on Github external
gulp.task('vendorScripts', function () {
  // Ensure package is updated.
  readPackage()
  var vb = browserify({
    debug: true,
    require: pkg.dependencies ? Object.keys(pkg.dependencies) : []
  })
  return vb.bundle()
    .on('error', log.bind(log, 'Browserify Error'))
    .pipe(source('vendor.js'))
    .pipe(buffer())
    .pipe($.sourcemaps.init({ loadMaps: true }))
    .pipe($.sourcemaps.write('./'))
    .pipe(gulp.dest('.tmp/assets/scripts/'))
    .pipe(bs.stream())
})
github appium / appium / commands-yml / parse.js View on Github external
}

  const commandTemplate = Handlebars.compile(await fs.readFile(path.resolve(rootFolder, 'commands-yml', 'api-template.md'), 'utf8'), {noEscape: true, strict: true});

  async function writeIndex (index, commands, indexPath) {
    log(`Creating API index '${index}'`);
    const commandMarkdown = commandTemplate({
      commands,
      path: indexPath,
    });
    await fs.writeFile(index, commandMarkdown, 'utf8');
  }

  const apiIndex = path.resolve(rootFolder, 'docs', 'en', 'about-appium', 'api.md');
  await writeIndex(apiIndex, commands);
  log(`Done writing main API index`);

  async function writeIndividualIndexes (command) {
    if (!util.hasValue(command.commands)) {
      // this is a leaf, so end
      return;
    }

    // write this node
    const relPath = command.path.startsWith(path.sep) ? command.path.substring(1) : command.path;
    const index = path.resolve(rootFolder, relPath, 'README.md');
    await writeIndex(index, command.commands, command.path);

    // go through all the sub-commands
    for (const el of command.commands) {
      await writeIndividualIndexes(el);
    }
github mysticatea / eslint4b / scripts / build.js View on Github external
// Remove a dynamic import for rules (I suspect this is a dead code).
                    {
                        match: /eslint(\/|\\)lib(\/|\\)linter(\/|\\)rules\.js$/u,
                        test: /require\(this\._rules\[ruleId\]\)/u,
                        replace: "null",
                    },
                ],
            }),
            json({ preferConst: true }),
            commonjs(),
            sourcemaps(),
        ],
    })

    //--------------------------------------------------------------------------
    log.info("Generate file contents.")

    const { output } = await bundle.generate({
        format: "cjs",
        sourcemap: true,
    })

    //--------------------------------------------------------------------------
    log.info("Minify file contents.")

    const promises = []

    for (const { code: rawCode, fileName, map: rawMap } of output) {
        log.info("- %s", fileName)

        const filePath = path.join("dist", fileName)
        const { code, map } = babel.transform(rawCode, {

fancy-log

Log things, prefixed with a timestamp.

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis