-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.default.js
44 lines (37 loc) · 1.11 KB
/
config.default.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
const path = require('path');
module.exports = (appInfo, appConfig) => {
const config = {};
/**
* egg-opentracing default config
* @member Config#opentracing
* @property {String} globalTracer - override the default Tracer
* @property {Object} carrier - the map of carriers
* @property {Object} collector - the map of collectors
*/
config.opentracing = {
globalTracer: require('../lib/tracer'),
carrier: {
HTTP: require('../lib/carrier/http_carrier'),
},
collector: {
log: require('../lib/collector/log_collector'),
},
};
const isLogCollectorDisabled = checkDisableLogCollector(appConfig);
if (!isLogCollectorDisabled) {
config.customLogger = {
opentracingLogger: {
file: path.join(appInfo.root, 'logs', appInfo.name, 'opentracing.log'),
consoleLevel: 'NONE',
},
};
}
return config;
};
function checkDisableLogCollector(appConfig) {
/* istanbul ignore if */
if (!appConfig.opentracing) return false;
if (!appConfig.opentracing.collector) return false;
return appConfig.opentracing.collector.log === false;
}