Comparing version 1.1.1 to 1.1.2
@@ -0,1 +1,8 @@ | ||
## v1.1.1 - v1.1.2 / 2015-10 | ||
### MINOR FIXES EDITION | ||
#### Notable changes | ||
* [727](https://github.com/winstonjs/winston/pull/727) Fix "raw" mode (`jcrugzz`) | ||
* [703](https://github.com/winstonjs/winston/pull/703) Do not modify Error or Date objects when logging. Fixes #610 (`harriha`). | ||
## v1.1.0 / 2015-10-09 | ||
@@ -2,0 +9,0 @@ ### GREETINGS FROM CARTAGENA EDITION |
@@ -83,4 +83,13 @@ /* | ||
// | ||
var copy = {}; | ||
if (obj instanceof Error) { | ||
return obj; | ||
// With potential custom Error objects, this might not be exactly correct, | ||
// but probably close-enough for purposes of this lib. | ||
copy = new Error(obj.message); | ||
Object.getOwnPropertyNames(obj).forEach(function (key) { | ||
copy[key] = obj[key]; | ||
}); | ||
return copy; | ||
} | ||
@@ -91,6 +100,5 @@ else if (!(obj instanceof Object)) { | ||
else if (obj instanceof Date) { | ||
return obj; | ||
return new Date(obj.getTime()); | ||
} | ||
var copy = {}; | ||
for (var i in obj) { | ||
@@ -97,0 +105,0 @@ if (Array.isArray(obj[i])) { |
{ | ||
"name": "winston", | ||
"description": "A multi-transport async logging library for Node.js", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -95,2 +95,38 @@ /* | ||
}).addBatch({ | ||
"Error object in metadata #610": { | ||
topic: function () { | ||
var myErr = new Error("foo"); | ||
fileTransport.log('info', 'test message', myErr, this.callback.bind(this, null, myErr)); | ||
}, | ||
"should not be modified": function (err, myErr) { | ||
assert.equal(myErr.message, "foo"); | ||
// Not sure if this is the best possible way to check if additional props appeared | ||
assert.deepEqual(Object.getOwnPropertyNames(myErr), Object.getOwnPropertyNames(new Error("foo"))); | ||
} | ||
} | ||
}).addBatch({ | ||
"Date object in metadata": { | ||
topic: function () { | ||
var obj = new Date(1000); | ||
fileTransport.log('info', 'test message', obj, this.callback.bind(this, null, obj)); | ||
}, | ||
"should not be modified": function (err, obj) { | ||
// Not sure if this is the best possible way to check if additional props appeared | ||
assert.deepEqual(Object.getOwnPropertyNames(obj), Object.getOwnPropertyNames(new Date())); | ||
} | ||
} | ||
}).addBatch({ | ||
"Plain object in metadata": { | ||
topic: function () { | ||
var obj = { message: "foo" }; | ||
fileTransport.log('info', 'test message', obj, this.callback.bind(this, null, obj)); | ||
}, | ||
"should not be modified": function (err, obj) { | ||
assert.deepEqual(obj, { message: "foo" }); | ||
} | ||
} | ||
}).addBatch({ | ||
"An instance of the File Transport": transport(winston.transports.File, { | ||
@@ -97,0 +133,0 @@ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log') |
@@ -96,4 +96,34 @@ /* | ||
} | ||
}, | ||
"the clone() method": { | ||
"with Error object": { | ||
topic: function () { | ||
var original = new Error("foo"); | ||
original.name = "bar"; | ||
var copy = winston.clone(original); | ||
return { original: original, copy: copy }; | ||
}, | ||
"should clone the value": function (result) { | ||
assert.notEqual(result.original, result.copy); | ||
assert.equal(result.original.message, result.copy.message); | ||
assert.equal(result.original.name, result.copy.name); | ||
} | ||
}, | ||
"with Date object": { | ||
topic: function () { | ||
var original = new Date(1000); | ||
var copy = winston.clone(original); | ||
return { original: original, copy: copy }; | ||
}, | ||
"should clone the value": function (result) { | ||
assert.notEqual(result.original, result.copy); | ||
assert.equal(result.original.getTime(), result.copy.getTime()); | ||
} | ||
} | ||
} | ||
} | ||
}).export(module); |
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
270044
6132