Skip to content

Commit 9be75c4

Browse files
committed
Merge pull request #31 from ducas/master
Use options to add timestamp into meta on each log
2 parents e14d8bb + 0f6ee30 commit 9be75c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/winston-loggly.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ var Loggly = exports.Loggly = function (options) {
5757
isBulk: options.isBulk || false
5858
});
5959

60+
this.timestamp = options.timestamp || false;
6061
this.stripColors = options.stripColors || false;
6162
};
6263

@@ -89,6 +90,11 @@ Loggly.prototype.log = function (level, msg, meta, callback) {
8990
return callback(null, true);
9091
}
9192

93+
if (this.timestamp && (!meta || !meta.timestamp)) {
94+
meta = meta || {};
95+
meta.timestamp = (new Date()).toISOString();
96+
}
97+
9298
if (this.stripColors) {
9399
msg = ('' + msg).replace(code, '');
94100
}

0 commit comments

Comments
 (0)