Skip to content

Commit

Permalink
refactor: use picocolors instead of nanocolors (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Mar 22, 2022
1 parent 670468a commit 40199b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions lib/log.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { Console } = require('console');
const nanocolors = require('nanocolors');
const picocolors = require('picocolors');

const TRACE = 10;
const DEBUG = 20;
Expand Down Expand Up @@ -55,14 +55,14 @@ class Logger {
const str = new Date().toISOString().substring(11, 23) + ' ';

if (level === TRACE || level >= WARN) {
process.stderr.write(nanocolors[LEVEL_COLORS[DEBUG]](str));
process.stderr.write(picocolors[LEVEL_COLORS[DEBUG]](str));
} else {
process.stdout.write(nanocolors[LEVEL_COLORS[DEBUG]](str));
process.stdout.write(picocolors[LEVEL_COLORS[DEBUG]](str));
}
}

if (level >= this.level) {
const str = nanocolors[LEVEL_COLORS[level]](LEVEL_NAMES[level]) + ' ';
const str = picocolors[LEVEL_COLORS[level]](LEVEL_NAMES[level]) + ' ';
if (level === TRACE || level >= WARN) {
process.stderr.write(str);
} else {
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
"Abner Chou <[email protected]> (http://abnerchou.me)"
],
"license": "MIT",
"dependencies": {
"nanocolors": "^0.2.12"
},
"devDependencies": {
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
Expand All @@ -43,5 +40,8 @@
},
"engines": {
"node": ">=12.4.0"
},
"dependencies": {
"picocolors": "^1.0.0"
}
}

0 comments on commit 40199b2

Please sign in to comment.