Permalink
Browse files

[fix] Add support for cloning and serializing Date instances. Fixes #92

  • Loading branch information...
1 parent efa59d7 commit ca3bd4101d08acc553f7cd249cde650953ca8dd4 @indexzero indexzero committed Feb 22, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/winston/common.js
@@ -71,6 +71,9 @@ exports.clone = function (obj) {
if (!(obj instanceof Object)) {
return obj;
}
+ else if (obj instanceof Date) {
+ return obj;
+ }
var copy = {};
for (var i in obj) {
@@ -220,6 +223,9 @@ exports.serialize = function (obj, key) {
msg += ']';
}
+ else if (obj[keys[i]] instanceof Date) {
+ msg += keys[i] + '=' + obj[keys[i]];
+ }
else {
msg += exports.serialize(obj[keys[i]], keys[i]);
}

0 comments on commit ca3bd41

Please sign in to comment.