Skip to content

Instantly share code, notes, and snippets.

@calvin
Created August 9, 2016 01:27
Show Gist options
  • Save calvin/f72be59338ccbaefb5f9617d33fe2e3a to your computer and use it in GitHub Desktop.
Save calvin/f72be59338ccbaefb5f9617d33fe2e3a to your computer and use it in GitHub Desktop.
/*
* transports.js: Set of all transports Winston knows about
*
* (C) 2010 Charlie Robbins
* MIT LICENCE
*
*/
var path = require('path');
var libs = {
'Console': require('./transports/console'),
'File': require('./transports/file'),
'Memory': require('./transports/memory'),
}
//
// Setup all transports as lazy-loaded getters.
//
Object.defineProperties(
exports,
['Console', 'File', 'Memory']
.reduce(function (acc, name) {
acc[name] = {
configurable: true,
enumerable: true,
get: function () {
return libs[name][name];
}
};
return acc;
}, {})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment