stuff
This commit is contained in:
36
buildfiles/app/node_modules/@dabh/diagnostics/node/development.js
generated
vendored
Normal file
36
buildfiles/app/node_modules/@dabh/diagnostics/node/development.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
var create = require('../diagnostics');
|
||||
var tty = require('tty').isatty(1);
|
||||
|
||||
/**
|
||||
* Create a new diagnostics logger.
|
||||
*
|
||||
* @param {String} namespace The namespace it should enable.
|
||||
* @param {Object} options Additional options.
|
||||
* @returns {Function} The logger.
|
||||
* @public
|
||||
*/
|
||||
var diagnostics = create(function dev(namespace, options) {
|
||||
options = options || {};
|
||||
options.colors = 'colors' in options ? options.colors : tty;
|
||||
options.namespace = namespace;
|
||||
options.prod = false;
|
||||
options.dev = true;
|
||||
|
||||
if (!dev.enabled(namespace) && !(options.force || dev.force)) {
|
||||
return dev.nope(options);
|
||||
}
|
||||
|
||||
return dev.yep(options);
|
||||
});
|
||||
|
||||
//
|
||||
// Configure the logger for the given environment.
|
||||
//
|
||||
diagnostics.modify(require('../modifiers/namespace-ansi'));
|
||||
diagnostics.use(require('../adapters/process.env'));
|
||||
diagnostics.set(require('../logger/console'));
|
||||
|
||||
//
|
||||
// Expose the diagnostics logger.
|
||||
//
|
||||
module.exports = diagnostics;
|
8
buildfiles/app/node_modules/@dabh/diagnostics/node/index.js
generated
vendored
Normal file
8
buildfiles/app/node_modules/@dabh/diagnostics/node/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Select the correct build version depending on the environment.
|
||||
//
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./production.js');
|
||||
} else {
|
||||
module.exports = require('./development.js');
|
||||
}
|
21
buildfiles/app/node_modules/@dabh/diagnostics/node/override.js
generated
vendored
Normal file
21
buildfiles/app/node_modules/@dabh/diagnostics/node/override.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
const diagnostics = require('./');
|
||||
|
||||
//
|
||||
// Override the existing `debug` call so it will use `diagnostics` instead
|
||||
// of the `debug` module.
|
||||
//
|
||||
try {
|
||||
var key = require.resolve('debug');
|
||||
|
||||
require.cache[key] = {
|
||||
exports: diagnostics,
|
||||
filename: key,
|
||||
loaded: true,
|
||||
id: key
|
||||
};
|
||||
} catch (e) { /* We don't really care if it fails */ }
|
||||
|
||||
//
|
||||
// Export the default import as exports again.
|
||||
//
|
||||
module.exports = diagnostics;
|
24
buildfiles/app/node_modules/@dabh/diagnostics/node/production.js
generated
vendored
Normal file
24
buildfiles/app/node_modules/@dabh/diagnostics/node/production.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var create = require('../diagnostics');
|
||||
|
||||
/**
|
||||
* Create a new diagnostics logger.
|
||||
*
|
||||
* @param {String} namespace The namespace it should enable.
|
||||
* @param {Object} options Additional options.
|
||||
* @returns {Function} The logger.
|
||||
* @public
|
||||
*/
|
||||
var diagnostics = create(function prod(namespace, options) {
|
||||
options = options || {};
|
||||
options.namespace = namespace;
|
||||
options.prod = true;
|
||||
options.dev = false;
|
||||
|
||||
if (!(options.force || prod.force)) return prod.nope(options);
|
||||
return prod.yep(options);
|
||||
});
|
||||
|
||||
//
|
||||
// Expose the diagnostics logger.
|
||||
//
|
||||
module.exports = diagnostics;
|
Reference in New Issue
Block a user