-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates the logger usage so that it follows the patter the JSDoc clai…
…ms it does. Refactors the logger creation out to a getLogger() function so data-store and client can use a single codepath. Fixes #146
- Loading branch information
l12s
committed
Feb 28, 2016
1 parent
8482f78
commit 2576ee8
Showing
5 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Top level helpers. | ||
*/ | ||
|
||
var ConsoleTransport = require('winston').transports.Console; | ||
var bind = require('lodash').bind; | ||
var winston = require('winston'); | ||
|
||
|
||
/** | ||
* | ||
* @param {string} optLogLevel | ||
* @param {Object} optTransport | ||
* @returns {function(this:*)|Function|*} | ||
*/ | ||
var getLogger = function getLogger(optLogLevel, optTransport) { | ||
var logger = new winston.Logger({ | ||
level: optLogLevel || 'info', | ||
transports: [optTransport || new ConsoleTransport()], | ||
}); | ||
return bind(logger.log, logger); | ||
}; | ||
|
||
|
||
module.exports.getLogger = getLogger; |