How to use single-line-log - 10 common examples

To help you get started, we’ve selected a few single-line-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 maka-io / maka-cli / lib / tools / logging.js View on Github external
singleLineLog: function singleLineLog(/* args */) {
    return log.apply(log, arguments);
  },
github alibaba / funcraft / lib / edge / container.js View on Github external
if (event.progress) {
          status = `${event.status} ${event.progress}`;
        }
        if (event.id) {
          statuses[event.id] = status;
        }
        // Print
        let output = '';
        const keys = Object.keys(statuses);
        for (const key of keys) {
          output += key + ': ' + statuses[key] + '\n';
        }
        if (!event.id) {
          output += event.status;
        }
        slog(output);
      };
      this.docker.modem.followProgress(stream, onFinished, onProgress);
github steveblue / angular2-rollup / src / log.js View on Github external
fail(msg) {
        // if (!this.hasError()) {
        //   this.destroy();
        // }
        msg = msg ? '' + colors.red(msg) : '';
        logger(msg);
        process.stderr.write('\x1B[?25l');
        if (cli.program.verbose) this.break();
    }
github davidmerfield / Blot / scripts / entry / each / validate.js View on Github external
eachEntry(function(user, blog, entry, _next){

  var next = function(){
    log(' ✔ All entries checked');
    _next();
  };

  log(' ',entry.id + '.', entry.path);

  if (type(entry, 'number')) {
    return fakeEntry(blog.id, entry, next);
  }

  fix(blog, entry, function(entry, changes){

    ensure(entry, Entry.model, true);

    Entry.set(blog.id, entry.id, entry, function(err){

      if (err) throw err;

      Entry.get(blog.id, entry.id, function(savedEntry){

        // The entry changed, lets work out
github grumd / osu-pps / update-scripts / fetch-beatmaps-for-users.js View on Github external
const fetchUserBeatmaps = (userId, modeId, scoresCount, retryCount = 0) => {
  if (retryCount > 3) {
    return Promise.reject(new Error('Too many retries'));
  }
  retryCount && oneLineLog(`Retry #${retryCount}`);
  return axios.get(getUrl(userId, modeId, scoresCount)).catch(err => {
    console.log('Error:', err.message);
    return delay(5000).then(() => fetchUserBeatmaps(userId, modeId, scoresCount, retryCount + 1));
  });
};
github grumd / osu-pps / update-scripts / rankings.js View on Github external
const fetchUser = (userId, modeId, retryCount = 0) => {
  if (retryCount > 3) {
    return Promise.reject(new Error('Too many retries'));
  }
  retryCount && oneLineLog(`Retry #${retryCount}`);
  return axios.get(getUrl(userId, modeId)).catch(err => {
    console.log('Error:', err.message);
    return delay(5000).then(() => fetchUser(userId, modeId, retryCount + 1));
  });
};
github grumd / osu-pps / update-scripts / fetch-users-list.js View on Github external
const fetchCountryPage = (modeText, page, country, retryCount = 0) => {
  if (retryCount > 3) {
    console.log('\nToo many retries, going forward');
    return Promise.reject();
  }
  oneLineLog(`Fetching page #${page} (${modeText})` + (retryCount ? ` Retry #${retryCount}` : ''));
  return axios.get(getUsersUrl(modeText, page, country)).catch(err => {
    console.log('Error:', err.message);
    console.log(err);
    return delay(10000).then(() => fetchCountryPage(modeText, page, country, retryCount + 1));
  });
};
github mikermcneil / sails-deploy-azure / index.js View on Github external
success: function (scriptOutput) {
                            if (scriptOutput.body && scriptOutput.body.indexOf('All done!') > -1) {
                              console.log('Deployment finished.')
                              console.log('The site should be available at ' + sitename + '.azurewebsites.net.');
                              clearInterval(spinnerInterval);
                              return cb();
                            } else {
                              if (scriptOutput.body) {
                                log(scriptOutput.body);
                                process.stdout.write('\r \033[36mcomputing\033[m ' + spinner.next());
                              }
                              setTimeout(getLog, 400);
                            }
                          }
                        });
github snovakovic / js-flock / benchmark / sort / index.js View on Github external
const run = function(implementation, randomizer) {
  const res = [];

  runConfiguration.forEach((conf, idx) => {
    res.push(implementation.run(Object.assign(conf, { randomizer })));
    log(`${idx + 1}/${runConfiguration.length}`);
    log.clear();
  });

  log('');

  const table = new Table({ head: headerItems });
  libraries.forEach((lib) => addRow(lib, res, table));

  console.log(table.toString());
};
github snovakovic / fast-sort / benchmark / index.js View on Github external
const run = function(implementation, randomizer) {
  const res = [];

  runConfiguration.forEach((conf, idx) => {
    res.push(implementation.run(Object.assign(conf, { randomizer })));
    log(`${idx + 1}/${runConfiguration.length}`);
    log.clear();
  });

  log('');

  const table = new Table({ head: headerItems });
  librariesToRun.forEach((lib) => addRow(lib, res, table));

  console.log(table.toString());
};

single-line-log

Keep writing to the same line in the terminal. Very useful when you write progress bars, or a status message during longer operations

MIT
Latest version published 8 years ago

Package Health Score

50 / 100
Full package analysis

Popular single-line-log functions