@poi/logger
Advanced tools
Comparing version 10.0.0 to 12.0.0-alpha.0
42
index.js
@@ -1,25 +0,33 @@ | ||
const util = require('util') | ||
const LogHorizon = require('log-horizon') | ||
const chalk = require('chalk') | ||
class Logger extends LogHorizon { | ||
inspect(title, obj) { | ||
if (this.options.logLevel < 4) return | ||
class Logger { | ||
constructor(options) { | ||
this.setOptions(options) | ||
} | ||
return this.debug( | ||
title, | ||
util.inspect(obj, { | ||
depth: null, | ||
colors: true | ||
}) | ||
) | ||
setOptions(options) { | ||
this.options = Object.assign({}, this.options, options) | ||
} | ||
debug(title, message = '') { | ||
return super.debug(`${chalk.inverse.bold.yellow(` ${title} `)} ${message}`) | ||
log(...args) { | ||
console.log(...args) | ||
} | ||
debug(...args) { | ||
if (!this.options.debug) { | ||
return | ||
} | ||
console.log(chalk.magenta.bold('===>'), ...args.map(str => chalk.bold(str))) | ||
} | ||
error(...args) { | ||
console.error(chalk.red(args.join(' '))) | ||
process.exitCode = process.exitCode || 1 | ||
} | ||
success(...args) { | ||
console.log(chalk.green('success'), ...args) | ||
} | ||
} | ||
module.exports = new Logger({ | ||
logUpdate: false | ||
}) | ||
module.exports = new Logger() |
{ | ||
"name": "@poi/logger", | ||
"version": "10.0.0", | ||
"version": "12.0.0-alpha.0", | ||
"files": [ | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"license": "MIT", | ||
"repository": "https://github.com/egoist/poi/tree/master/packages/logger", | ||
"dependencies": { | ||
"chalk": "^2.3.2", | ||
"log-horizon": "^0.1.2" | ||
"chalk": "^2.4.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
828
1
26
1
2
1
- Removedlog-horizon@^0.1.2
- Removedansi-escapes@3.2.0(transitive)
- Removedansi-regex@3.0.1(transitive)
- Removedcli-cursor@2.1.0(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedlog-horizon@0.1.2(transitive)
- Removedlog-update@2.3.0(transitive)
- Removedmimic-fn@1.2.0(transitive)
- Removedonetime@2.0.1(transitive)
- Removedrestore-cursor@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@2.1.1(transitive)
- Removedstrip-ansi@4.0.0(transitive)
- Removedwrap-ansi@3.0.1(transitive)
Updatedchalk@^2.4.1