Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
ansi-regex | 2.1.1 | 2.29 kB | MIT | prod | |
aproba | 1.2.0 | 3.44 kB | ISC | prod | |
are-we-there-yet | 1.1.7 | 5.11 kB | ISC | prod | |
code-point-at | 1.1.0 | 1.73 kB | MIT | prod | |
console-control-strings | 1.1.0 | 3.26 kB | ISC | prod | |
core-util-is | 1.0.3 | 1.85 kB | MIT | prod | |
delegates | 1.0.0 | 2.78 kB | MIT | prod | |
gauge | 2.7.4 | 15.64 kB | ISC | prod | |
has-unicode | 2.0.1 | 1.92 kB | ISC | prod | |
inherits | 2.0.4 | 1.98 kB | ISC | prod | |
is-fullwidth-code-point | 1.0.0 | 2.07 kB | MIT | prod | |
isarray | 1.0.0 | 1.97 kB | MIT | prod | |
npmlog | 4.0.2 | 6.28 kB | ISC | prod | |
number-is-nan | 1.0.1 | 1.43 kB | MIT | prod | |
object-assign | 4.1.1 | 2.61 kB | MIT | prod | |
process-nextick-args | 2.0.1 | 1.62 kB | MIT | prod | |
readable-stream | 2.3.8 | 25.14 kB | MIT | prod | |
safe-buffer | 5.1.2 | 9.59 kB | MIT | prod | |
set-blocking | 2.0.0 | 2.16 kB | ISC | prod | |
signal-exit | 3.0.7 | 3.76 kB | ISC | prod | |
string-width | 1.0.2 | 2.03 kB | MIT | prod | |
string_decoder | 1.1.1 | 4.72 kB | MIT | prod | |
strip-ansi | 3.0.1 | 1.69 kB | MIT | prod | |
util-deprecate | 1.0.2 | 2.19 kB | MIT | prod | |
wide-align | 1.1.5 | 1.95 kB | ISC | prod |
npmlog is a basic logging utility that is used by npm. It sports robust features such as support for custom logging levels and color-coded output. By default, log messages are written to the stderr stream but this can be changed as per your preference. Beyond standard logging, npmlog sports color and style customization options, allows you to pause and resume logs, and even hosts a functionality to display a progress spinner.
npmlog is straightforward to use and it can be included in your JavaScript project with a single line of code. First, it needs to be installed through npm with: npm install npmlog --save
. After it's installed, it can be used by requiring it in your project like so:
var log = require('npmlog')
log.info('fyi', 'I have a kitty cat: %j', myKittyCat);
It provides several methods to display logs at different levels. For example, you can log a message at the verbose level by simply calling: log.verbose('prefix', 'message')
.
Additionally, you can control the logging level by setting the 'log.level' property. For instance, log.level = "warn"
will cause all severe mistakes to be logged. The level "silent" will suppress all logs.
The documentation for npmlog can be found on the npm webpage dedicated to the package, as well as within the README file in its GitHub repository. Please note that to dive deeper into certain methods like setGaugeTemplate or setGaugeThemeset, you may need to refer to the '[gauge documentation]' (https://npmjs.com/package/gauge) as it is bundled with npmlog for displaying the progress bar. Similarly, some method documentations redirect to the are-we-there-yet
package (for methods like newItem
, newStream
, newGroup
), which is used for tracking the progress of tasks.