GithubHelp home page GithubHelp logo

log-symbols's Introduction

log-symbols

Colored symbols for various log levels

Includes fallbacks for Windows CMD which only supports a limited character set.

Install

npm install log-symbols

Usage

import logSymbols from 'log-symbols';

console.log(logSymbols.success, 'Finished successfully!');
// Terminals with Unicode support:     ✔ Finished successfully!
// Terminals without Unicode support:  √ Finished successfully!

API

logSymbols

info

success

warning

error

Related

log-symbols's People

Contributors

bendingbender avatar brandon93s avatar coreyfarrell avatar gucong3000 avatar guumaster avatar kevgo avatar magicdawn avatar manrajgrover avatar palash25 avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

log-symbols's Issues

precompute chalk

By replacing this chalk:

log-symbols/index.js

Lines 4 to 16 in 6aea985

const main = {
info: chalk.blue('ℹ'),
success: chalk.green('✔'),
warning: chalk.yellow('⚠'),
error: chalk.red('✖')
};
const fallback = {
info: chalk.blue('i'),
success: chalk.green('√'),
warning: chalk.yellow('‼'),
error: chalk.red('×')
};

... with precomputed values:

const main = {
  info: '\x1B[34mℹ\x1B[39m',
  success: '\x1B[32m✔\x1B[39m',
  warning: '\x1B[33m⚠\x1B[39m',
  error: '\x1B[31m✖\x1B[39m'
};

const fallback = {
  info: '\x1B[34mi\x1B[39m',
  success: '\x1B[32m√\x1B[39m',
  warning: '\x1B[33m‼\x1B[39m',
  error: '\x1B[31m×\x1B[39m'
};

Then it's possible to minimize the package size/JIT by a lot... seems like a worthy tradeoff for readability?

The only dep you would need would be: is-unicode-supported
https://npmgraph.js.org/?q=log-symbols

Another option is to have chalk as a dev dependency and generate them before publishing

Missing module 'is-unicode-supported'

Environment:

  • Node v14.16.0
  • npm 7.6.3
  • Windows 10 x64 20H2
  • Command Prompt

I'm trying to install Cypress 6.8.0, but it fails with: Error: Cannot find module 'is-unicode-supported'. I identified that cypress uses log-symbols, which in turn uses is-unicode-supported; however, when I run npm install, cypress installs log-symbols, but log-symbols does not install is-unicode-supported.

Move to "import" broke things

typescript compiles fine, but I get these errors when I run. I am not willing to change package.json to make this work.

node:internal/modules/cjs/loader:1109
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/mesoic/Desktop/chainlink/node-operator-management/pegswap/node_modules/log-symbols/index.js
require() of ES modules is not supported.

Broken Formatting in linux terminal.

Opened an issue with a library consuming log-symbols, #15.

Getting strange output in Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux terminal. Its only on the checkmark. The other symbols are fine.
ym4byfp

symbols are glitching in Ubuntu

Hello, I found symbols glitching in Ubuntu Server 20.04 LTS (HVM) as follows.

Step to Reproduce:
I followed instructions in npm page

// index.js
import logSymbols from 'log-symbols';

console.log(logSymbols.info, "info");
console.log(logSymbols.success, "success");
console.log(logSymbols.warning, "warning");
console.log(logSymbols.error, "error");

and got this as a result.

image

Versions:
"log-symbols": "^5.0.0"
OS: Ubuntu Server 20.04 LTS (HVM)
node: v14.17.2

I looked up issues and PRs but not found a similar issue.
If this is a known problem let me know. Thank you in advance.

Version 2 error

I got error with version 2

fs.js:651
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/oknoorap/workspace/git/playground/node_modules/log-symbols/node_modules/chalk/index.js'
    at Object.fs.openSync (fs.js:651:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at Object.Module._extensions..js (module.js:579:20)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/oknoorap/workspace/git/playground/node_modules/log-symbols/index.js:3:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.