How to use log-symbols - 10 common examples

To help you get started, we’ve selected a few log-symbols 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 phenomic / phenomic / packages / core / src / logger / __tests__ / index.js View on Github external
const log = logger("sender test", false);

  // we can't snapshot because of logSymbols & colors...
  const colorStart =
    process.platform !== "win32" && !process.env.CIRCLECI ? "" : "";
  const colorEnd =
    process.platform !== "win32" && !process.env.CIRCLECI ? "" : "";

  expect(log("test msg")).toBe(
    `${logSymbols.info} ${colorStart}sender test:${colorEnd} test msg`,
  );
  expect(log.debug("test debug")).toBe(
    `  ${colorStart}sender test:${colorEnd} test debug`,
  );
  expect(log.info("test info")).toBe(
    `${logSymbols.info} ${colorStart}sender test:${colorEnd} test info`,
  );
  expect(log.success("test success")).toBe(
    `${logSymbols.success} ${colorStart}sender test:${colorEnd} test success`,
  );
  expect(log.warn("test warning")).toBe(
    `${logSymbols.warning} ${colorStart}sender test:${colorEnd} test warning`,
  );
  expect(log.error("test error")).toBe(
    `${logSymbols.error} ${colorStart}sender test:${colorEnd} test error`,
  );
});
github xxczaki / oji / lib / functions.js View on Github external
module.exports.delete = () => { // Delete saved emoticons
	try {
		fs.unlinkSync(`${homeDir}/saved_emoji.txt`);
		console.log(chalk.green.bold(`${logSymbols.success} Successfully deleted all saved emoticons!`));
		return;
	} catch (err) {
		if (err.code === 'ENOENT') {
			console.log(chalk.red(`${logSymbols.error} File ${homeDir}/saved_emoji.txt not found :(`));
			process.exit(1);
		}
	}
};
github micromata / Baumeister / build / handlebars.js View on Github external
.build(err => {
    // Handle build errors
    if (err) {
      console.log(stripIndents`
				${logSymbols.error} Handlebars build failed:
				${chalk.red.bold(err.message)}
			`);
      process.exit(1);
    } else {
      // Handle successful build
      /**
       * NOTE:
       * We need to backdate the generated files by ten seconds until
       * https://github.com/webpack/watchpack/issues/25 is fixed.
       * Otherwise we would have some unneeded rebuilds when starting webpack in
       * watch mode or starting the webpack dev server.
       */
      const f = path.resolve(
        __dirname,
        '../',
        settings.destinations.handlebars
github rdev / expressx / src / init / index.js View on Github external
proc.on('exit', async (code) => {
		if (code === 0) {
			if (flow) {
				try {
					await installFlow();
				} catch (e) {
					spinner.fail('There was an error installing dependencies.');
				}
			}

			spinner.stop();
			console.log();
			console.log(ls.success, chalk.green('Woohoo! Everything is good to go!'));
			console.log('To start your app, just run:');
			console.log();
			console.log(chalk.cyan('    npm start'));
			console.log();
			console.log('Happy coding!');

			process.exit(); // eslint-disable-line unicorn/no-process-exit
		} else {
			spinner.fail('There was an error installing dependencies.');
		}
	});
}
github sarfraznawaz2005 / whatspup / chat.js View on Github external
async function startChat(user) {
      // replace selector with selected user
      let user_chat_selector = selector.user_chat;
      user_chat_selector = user_chat_selector.replace('XXX', user);

      await page.waitFor(user_chat_selector);
      await page.click(user_chat_selector);
      await page.click(selector.chat_input);
      let name = getCurrentUserName();

      if (name) {
        console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));
        console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\n'));
      } else {
        console.log(logSymbols.warning, 'Could not find specified user "' + user + '"in chat threads\n');
      }
    }
github sarfraznawaz2005 / whatspup / chat.js View on Github external
async function startChat(user) {
      // replace selector with selected user
      let user_chat_selector = selector.user_chat;
      user_chat_selector = user_chat_selector.replace('XXX', user);

      await page.waitFor(user_chat_selector);
      await page.click(user_chat_selector);
      await page.click(selector.chat_input);
      let name = getCurrentUserName();

      if (name) {
        console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));
        console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\n'));
      } else {
        console.log(logSymbols.warning, 'Could not find specified user "' + user + '"in chat threads\n');
      }
    }
github swashata / wp-webpack-script / packages / scripts / src / bin / utils.ts View on Github external
export function printGeneralInfoMessage(msg: string, symbol?: string) {
	if (typeof symbol === 'undefined') {
		// eslint-disable-next-line no-param-reassign
		symbol = logSymbols.info;
	}
	console.info(addTimeStampToLog(`${symbol} ${msg}`));
}
github litixsoft / karma-mocha-reporter / index.js View on Github external
var colors = {
        success: {
            symbol: config.mochaReporter.symbols.success || stripAnsi(symbols.success),
            print: chalk[config.mochaReporter.colors.success] || chalk.green
        },
        info: {
            symbol: config.mochaReporter.symbols.info || stripAnsi(symbols.info),
            print: chalk[config.mochaReporter.colors.info] || chalk.grey
        },
        warning: {
            symbol: config.mochaReporter.symbols.warning || stripAnsi(symbols.warning),
            print: chalk[config.mochaReporter.colors.warning] || chalk.yellow
        },
        error: {
            symbol: config.mochaReporter.symbols.error || stripAnsi(symbols.error),
            print: chalk[config.mochaReporter.colors.error] || chalk.red
        }
    };

    // init max number of log lines
    config.mochaReporter.maxLogLines = config.mochaReporter.maxLogLines || 999;

    if (isNaN(config.mochaReporter.maxLogLines)) {
        self.write(colors.warning.print('Option "config.mochaReporter.maxLogLines" must be of type number. Default value 999 is used!'));
        config.mochaReporter.maxLogLines = 999;
    }

    // check if mocha is installed when showDiff is enabled
    if (config.mochaReporter.showDiff) {
        try {
            var mocha = require('mocha');
github bentonam / fakeit / app / logger.js View on Github external
spinner.fail = function fail(err) {
      spinner.stopAndPersist(symbols.error);
      // stop the rest of spinners
      to.each(self.spinners, ({ value }) => {
        value.originalStop();
      });

      self.log('error', err);
    };
github neo-one-suite / neo-one / packages / neo-one-cli / src / interactive / createCRUD.js View on Github external
const getSymbol = (task: TaskStatus, spinners: Spinners) => {
  if (spinners[task.id] == null) {
    // eslint-disable-next-line
    spinners[task.id] = elegantSpinner();
  }

  const hasSubtasks = task.subtasks != null && task.subtasks.length > 0;
  if (task.pending) {
    return hasSubtasks ? pointer : chalk.yellow(spinners[task.id]());
  }

  if (task.complete) {
    return logSymbols.success;
  }

  if (task.error != null) {
    return hasSubtasks ? pointer : logSymbols.error;
  }

  if (task.skipped != null) {
    return skipped;
  }

  return ' ';
};

log-symbols

Colored symbols for various log levels. Example: `✔︎ Success`

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis