status-logger
Advanced tools
Comparing version 1.0.0 to 2.0.0
18
index.js
var singleLineLog = require('single-line-log') | ||
module.exports = function (opts) { | ||
if (!opts) opts = {} | ||
var logger = getLogger(opts) | ||
@@ -10,17 +11,6 @@ | ||
var LOG_INTERVAL = (opts.logspeed ? +opts.logspeed : 200) | ||
if (isNaN(LOG_INTERVAL)) LOG_INTERVAL = 200 | ||
setInterval(function () { | ||
print() | ||
}, LOG_INTERVAL) | ||
print() | ||
process.on('exit', function (code) { | ||
if (code !== 1) print() | ||
}) | ||
return { | ||
message: message, | ||
status: status | ||
status: status, | ||
print: print | ||
} | ||
@@ -40,3 +30,3 @@ | ||
function print () { | ||
logger.stdout() // Clear old stdout before printing messages | ||
// logger.stdout() // Clear old stdout before printing messages | ||
while (true) { | ||
@@ -43,0 +33,0 @@ if (messageQueue.length === 0) break |
{ | ||
"name": "status-logger", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "print updating progress to console and stdout", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,3 @@ | ||
``` | ||
```javascript | ||
var statusLogger = require('status-logger') | ||
@@ -30,4 +30,10 @@ | ||
log.status('Overwrite line 1', 1) | ||
setInterval(function () { | ||
log.print() // print on interval | ||
}, 500) | ||
``` | ||
### `log.print()`: print status + messages | ||
### `log.message(msg)`: log a message | ||
@@ -39,4 +45,3 @@ | ||
* `logspeed`: interval for printing | ||
* `quiet`: do not print anything | ||
* `debug`: print everything to console.log or console.error |
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
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
4006
5
90
45