tplus-api
Version:
tplus api invoke
75 lines (68 loc) • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _tools = require('../util/tools');
var _tools2 = _interopRequireDefault(_tools);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var LogStore = /** @class */function () {
function LogStore() {
this.logParam = {
start: true,
baseContextURL: 'https://t224.cn-beijing.log.aliyuncs.com/',
logStore: 'newretail',
appParam: {},
ignores: ['log.aliyuncs.com']
};
}
//设置log的基本信息
LogStore.prototype.setLogConfigParam = function (start, baseContextURL, logStore) {
if (start === void 0) {
start = true;
}
if (baseContextURL === void 0) {
baseContextURL = 'https://t224.cn-beijing.log.aliyuncs.com/';
}
if (logStore === void 0) {
logStore = 'newretail';
}
this.logParam.start = start;
this.logParam.baseContextURL = baseContextURL;
this.logParam.logStore = logStore;
};
//设置log的仓库
LogStore.prototype.setLogStore = function (logStore) {
this.logParam.logStore = logStore;
};
//设置应用的附加参数
LogStore.prototype.setLogAppParam = function (appParam) {
if (appParam === void 0) {
appParam = {};
}
this.logParam.appParam = appParam;
};
//设置忽略列表 接收数组格式 不需要上传日志
LogStore.prototype.setLogIgnore = function (ignores) {
var _this = this;
if (ignores === void 0) {
ignores = [];
}
ignores.forEach(function (element) {
if (!_tools2.default.arrayContains(_this.logParam.ignores, element)) {
_this.logParam.ignores.push(element);
}
});
};
//是否需要上报
//1.判断开关参数是否开启 start
//2.判断是否子忽略列表里
LogStore.prototype.isUpload = function (baseURL) {
return this.logParam.start && !this.logParam.ignores.some(function (ignore) {
return baseURL.indexOf(ignore) > -1;
});
};
return LogStore;
}();
exports.default = LogStore;
//# sourceMappingURL=LogStore.js.map
//# sourceMappingURL=LogStore.js.map