Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[api] clone meta before creating entry.

  • Loading branch information...
commit 60d7bc74f928641fce50109ab844bb6c7cfd45e1 1 parent a9491b8
@chjj chjj authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/winston-mongodb.js
View
11 lib/winston-mongodb.js
@@ -9,6 +9,7 @@
var util = require('util');
var mongodb = require('mongodb');
var winston = require('winston');
+var common = require('winston/lib/winston/common');
//
// ### function MongoDB (options)
@@ -124,12 +125,10 @@ MongoDB.prototype.log = function (level, msg, meta, callback) {
return onError(err);
}
- var entry = {
- timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp()
- level: level,
- message: msg,
- meta: meta
- };
+ var entry = common.clone(meta) || {};
+ entry.timestamp = new Date;
+ entry.level = level;
+ entry.message = msg;
col.save(entry, { safe: self.safe }, function (err) {
if (err) {
Please sign in to comment.
Something went wrong with that request. Please try again.