Comparing version 0.1.0 to 0.1.1
var exports = module.exports = {} | ||
exports.DefaultFormatter = function() { | ||
this.format = (message, level, meta) => | ||
`${new Date().toISOString()} ${level} ${message} ${JSON.stringify(meta)}`; | ||
this.format = (message, level, meta) => { | ||
var tzoffset = (new Date()).getTimezoneOffset() * 60000; | ||
var localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0,-1); | ||
return `${localISOTime} ${level} ${message} ${JSON.stringify(meta)}`; | ||
} | ||
} |
{ | ||
"name": "hewer", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A small and flexible logging library", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/matchs/hewer", |
@@ -9,4 +9,4 @@ var assert = require('assert'); | ||
it('Should format the string correctly', function() { | ||
assert.ok(formatter.format('SOME MESSAGE', 'WHATEVER', {"K":"V"}).match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z WHATEVER SOME MESSAGE .+K.+V/)) | ||
assert.ok(formatter.format('SOME MESSAGE', 'WHATEVER', {"K":"V"}).match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} WHATEVER SOME MESSAGE .+K.+V/)) | ||
}) | ||
}); |
@@ -18,3 +18,3 @@ var assert = require('assert'); | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z INFO .+"a":"1".+"b":"2".+"c":"3"/)); | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} INFO .+"a":"1".+"b":"2".+"c":"3"/)); | ||
done(); | ||
@@ -30,3 +30,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z WARN .+"a":"1".+"b":"2".+"c":"3"/)); | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} WARN .+"a":"1".+"b":"2".+"c":"3"/)); | ||
done(); | ||
@@ -42,3 +42,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z ERROR .+"c":"3"/)); | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} ERROR .+"c":"3"/)); | ||
done(); | ||
@@ -55,3 +55,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z DEBUG .+"c":"3"/)); | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} DEBUG .+"c":"3"/)); | ||
done(); | ||
@@ -71,3 +71,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z INFO .+ \{\}/)) | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} INFO .+ \{\}/)) | ||
done(); | ||
@@ -82,3 +82,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z WARN .+ \{\}/)) | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} WARN .+ \{\}/)) | ||
done(); | ||
@@ -93,3 +93,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z ERROR .+ \{\}/)) | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} ERROR .+ \{\}/)) | ||
done(); | ||
@@ -105,3 +105,3 @@ }) | ||
.then(function(msg) { | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z DEBUG .+ \{\}/)) | ||
assert.ok(msg[0].match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} DEBUG .+ \{\}/)) | ||
done(); | ||
@@ -108,0 +108,0 @@ }) |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14086
14
290
1
79