logShim is an indirection layer. Call it with your moduleName (required) and:
logger object is set, it will return that.loadLogger(), returns something, it will return that.noopLogger, which does nothing.Note: shim._fix() ensures that any object returned from this method has all the
required functions. See _requiredKeys below.
Set logger to override everything else - this object (after a _fix() of course)
will be passed to all logShim users
_defaultLoad first tries to load winston, then bunyan, then debug, then
log4js.
Override this to install logic to run when a logShim user requests their log object.
If multiple versions of this library are loaded by a hierarchy of various libraries,
you won't be able to customize the logging for all of them - only the version you
install directly. logShim registers itself on global[pkg.name][pkg.version], giving
you access to all loaded shims.
_loadWinston loads a logger from the winston node module if it is installed
_loadBunyan loads a logger from the bunyan node module if it is installed
_loadDebug loads a logger from the debug node module if it is installed
_loadLog4js loads a logger from the log4js node module if it is installed
if key is a function on logger, we return true
_fix ensures that every logger has all the required methods.
You get _noopLogger when logging packages are installed - a logger that does nothing.
_tryRequire allows us to load non-dependency optional node modules
logShim
To allow libaries to participate in logging without dictating anything about that logging system.