You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
472 B
25 lines
472 B
'use strict';
|
|
|
|
const debug = require('debug');
|
|
|
|
let loggerProvider = debugLoggerProvider;
|
|
|
|
module.exports = exports = function getLogger (name) {
|
|
return loggerProvider(name);
|
|
};
|
|
|
|
exports.setLoggerProvider = function setLoggerProvider (provider) {
|
|
loggerProvider = provider;
|
|
};
|
|
|
|
function debugLoggerProvider (name) {
|
|
let logger = debug(name);
|
|
logger = logger.bind(logger);
|
|
|
|
return {
|
|
debug: logger,
|
|
info: logger,
|
|
warn: logger,
|
|
error: logger
|
|
};
|
|
}
|
|
|