Skip to content

Commit 47abd92

Browse files
version 1.5.0: Logger.close support
1 parent 09ba086 commit 47abd92

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/winston-mongodb.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -194,24 +194,26 @@ util.inherits(MongoDB, winston.Transport);
194194
*/
195195
winston.transports.MongoDB = MongoDB;
196196

197+
197198
/**
198199
* Closes MongoDB connection so using process would not hang up.
199200
* Used by winston Logger.close on transports.
200201
*/
201-
MongoDB.prototype.close = function () {
202+
MongoDB.prototype.close = function() {
202203
var self = this;
203-
204204
if (this.logDb) {
205-
this.logDb.close(function (error) {
206-
if(error) {
207-
console.error('Winston MongoDB transport encountered on error during closing.', error);
205+
this.logDb.close(function(err) {
206+
if (err) {
207+
console.error('Winston MongoDB transport encountered on error during' +
208+
' closing.', err);
208209
} else {
209210
self.logDb = null;
210211
}
211212
});
212213
}
213214
};
214215

216+
215217
/**
216218
* Core logging method exposed to Winston. Metadata is optional.
217219
* @param {string} level Level at which to log the message.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "winston-mongodb",
33
"license": "MIT",
4-
"version": "1.4.0",
4+
"version": "1.5.0",
55
"description": "A MongoDB transport for winston",
66
"author": "Charlie Robbins <[email protected]>",
77
"contributors": [

0 commit comments

Comments
 (0)