How to use log-update - 10 common examples

To help you get started, we’ve selected a few log-update 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 yvele / poosh / packages / poosh-cli / src / Logger.js View on Github external
function display() {

  if (this._logBuffer.length) {
    logUpdate.clear();

    // eslint-disable-next-line no-console
    console.log(this._logBuffer.join("\n"));

    this._logBuffer = [];
  }

  logUpdate(this._warningLine
    + output.getMatchingLine(this._status)
    + output.getUploadingLine(this._status)
    + output.getDeletingLine(this._status)
    + output.getStatLine(this._status)
    + output.getElapsedLine(this._status));
}
github yvele / poosh / packages / poosh-cli / src / Logger.js View on Github external
function display() {

  if (this._logBuffer.length) {
    logUpdate.clear();

    // eslint-disable-next-line no-console
    console.log(this._logBuffer.join("\n"));

    this._logBuffer = [];
  }

  logUpdate(this._warningLine
    + output.getMatchingLine(this._status)
    + output.getUploadingLine(this._status)
    + output.getDeletingLine(this._status)
    + output.getStatLine(this._status)
    + output.getElapsedLine(this._status));
}
github dematerializer / emoji-finder / src / cli.js View on Github external
const store = createStore(rootReducer, applyMiddleware(sagaMiddleware));

// Set emoji data:

const languageFromEnv = (process.env.LANG || 'en').split('.')[0].split('_')[0];
const languageFromArgs = cli.flags.dango ? 'en' : cli.input[0];
let language = languageFromArgs || languageFromEnv;

if (!['en', 'de'].includes(language)) {
	logUpdate(`⌨ ${language} not upported, using en`);
	logUpdate.done();
	language = 'en';
} else {
	logUpdate(`⌨ ${language}`);
	logUpdate.done();
}

const data = getDataForLanguage(language);

sagaMiddleware.run(inputEmojiSequenceSubmitted);

if (cli.flags.dango) {
	sagaMiddleware.run(currentQueryChanged, data); // data still needed for annotations!
} else {
	store.dispatch(setFindSuggestedEmoji(createSelectSuggestedEmojiForQuery(data)));
}

// Render once initially and every time the store changes:

const render = () => logUpdate(selectStyledInput(store.getState()));
// const render = () => {
github dematerializer / emoji-sentiment / src / build-data.js View on Github external
function* buildForPreset(preset) {
	logUpdate(`using emoji sentiment ranking v${preset.sentimentVersion} (${preset.tag})`);
	logUpdate.done();

	logUpdate('⇣ sentiment data');
	const rawData = yield buildRawData({
		url: preset.sentimentDataUrl,
	});
	logUpdate('✓ sentiment data');
	logUpdate.done();

	// Render emoji sentiment data file as JSON:

	logUpdate('⇣ write sentiment data file');

	fs.writeFileSync(`res/emoji-sentiment-data.${preset.tag}.json`, JSON.stringify(rawData.data, null, 2));

	logUpdate('✓ write sentiment data file');
github dematerializer / unicode-emoji-data / src / build-emoji-data.js View on Github external
url: preset.emojiDataUrl,
		getNameForCodepoint: unicodeData.getNameForCodepoint,
		getVariationSequencesForCodepoint: standardizedVariants.getVariationSequencesForCodepoint,
		getCombinationsForCodepoint: emojiSequences.getCombinationsForCodepoint,
		getShiftJisCodesForCodepoint: emojiSources.getShiftJisCodesForCodepoint,
	});
	logUpdate('✓ emoji-data');
	logUpdate.done();

	logUpdate('⇣ emoji-zwj-sequences');
	const emojiZwjSequences = yield buildEmojiZwjSequences({
		url: preset.emojiZwjSequencesUrl,
		getNameForCodepoint: unicodeData.getNameForCodepoint,
		getMetaForModifierName: emojiData.getMetaForModifierName,
	});
	logUpdate('✓ emoji-zwj-sequences');
	logUpdate.done();

	// Render emoji data file containing compact, nested emoji data:

	logUpdate('⇣ write data file');

	const combined = [
		...emojiData.emoji,
		...emojiSequences.flagEmoji,
		...emojiZwjSequences.zwjEmoji,
	];
	fs.writeFileSync('res/emoji-data.json', JSON.stringify(combined, null, 2));

	logUpdate('✓ write data file');
	logUpdate.done();
github dematerializer / emoji-sentiment / src / build-data.js View on Github external
function* buildForPreset(preset) {
	logUpdate(`using emoji sentiment ranking v${preset.sentimentVersion} (${preset.tag})`);
	logUpdate.done();

	logUpdate('⇣ sentiment data');
	const rawData = yield buildRawData({
		url: preset.sentimentDataUrl,
	});
	logUpdate('✓ sentiment data');
	logUpdate.done();

	// Render emoji sentiment data file as JSON:

	logUpdate('⇣ write sentiment data file');

	fs.writeFileSync(`res/emoji-sentiment-data.${preset.tag}.json`, JSON.stringify(rawData.data, null, 2));

	logUpdate('✓ write sentiment data file');
	logUpdate.done();
}
github dematerializer / unicode-emoji-data / src / build-emoji-data.js View on Github external
getNameForCodepoint: unicodeData.getNameForCodepoint,
		getVariationSequencesForCodepoint: standardizedVariants.getVariationSequencesForCodepoint,
		getCombinationsForCodepoint: emojiSequences.getCombinationsForCodepoint,
		getShiftJisCodesForCodepoint: emojiSources.getShiftJisCodesForCodepoint,
	});
	logUpdate('✓ emoji-data');
	logUpdate.done();

	logUpdate('⇣ emoji-zwj-sequences');
	const emojiZwjSequences = yield buildEmojiZwjSequences({
		url: preset.emojiZwjSequencesUrl,
		getNameForCodepoint: unicodeData.getNameForCodepoint,
		getMetaForModifierName: emojiData.getMetaForModifierName,
	});
	logUpdate('✓ emoji-zwj-sequences');
	logUpdate.done();

	// Render emoji data file containing compact, nested emoji data:

	logUpdate('⇣ write data file');

	const combined = [
		...emojiData.emoji,
		...emojiSequences.flagEmoji,
		...emojiZwjSequences.zwjEmoji,
	];
	fs.writeFileSync('res/emoji-data.json', JSON.stringify(combined, null, 2));

	logUpdate('✓ write data file');
	logUpdate.done();

	// Create temporary expanded human readable emoji data containing flattened
github EvanBacon / react-native-ink / src / modules / Instance / index.tsx View on Github external
this.rootNode.onImmediateRender = this.onRender;

      this.renderer = createRenderer({
        terminalWidth: options.stdout.columns,
      });
    } else {
      this.rootNode = dom.createNode('root');
      this.rootNode.onRender = this.onRender;

      this.renderer = createRenderer({
        terminalWidth: options.stdout.columns,
      });
    }

    this.log = logUpdate.create(options.stdout);
    this.throttledLog = options.debug
      ? this.log
      : throttle(this.log, {
          leading: true,
          trailing: true,
        } as any);

    // Ignore last render after unmounting a tree to prevent empty output before exit
    this.isUnmounted = false;

    // Store last output to only rerender when needed
    this.lastOutput = '';

    // This variable is used only in debug mode to store full static output
    // so that it's rerendered every time, not just new static parts, like in non-debug mode
    this.fullStaticOutput = '';
github vadimdemedes / ink / src / instance.js View on Github external
this.rootNode.onImmediateRender = this.onRender;

			this.renderer = createExperimentalRenderer({
				terminalWidth: options.stdout.columns
			});
		} else {
			this.rootNode = dom.createNode('root');
			this.rootNode.onRender = this.onRender;

			this.renderer = createRenderer({
				terminalWidth: options.stdout.columns
			});
		}

		this.log = logUpdate.create(options.stdout);
		this.throttledLog = options.debug ? this.log : throttle(this.log, {
			leading: true,
			trailing: true
		});

		// Ignore last render after unmounting a tree to prevent empty output before exit
		this.isUnmounted = false;

		// Store last output to only rerender when needed
		this.lastOutput = '';

		// This variable is used only in debug mode to store full static output
		// so that it's rerendered every time, not just new static parts, like in non-debug mode
		this.fullStaticOutput = '';

		if (options.experimental) {
github codekirei / node-multispinner / lib / voidOut.js View on Github external
module.exports = function() {
  // create writable stream
  const stream = new Writable()

  // ignore (do not print) chunk, just call next
  stream._write = (chunk, enc, next) => { next() }

  // use this stream for logUpdate calls
  return logUpdate.create(stream)
}

log-update

Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.

MIT
Latest version published 5 months ago

Package Health Score

78 / 100
Full package analysis