mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-27 05:19:51 +08:00
chore(logging): 将bgi_tools配置日志级别从info调整为debug
- 修改config.js中的日志级别设置 - 将bgi_tools配置信息的日志输出从info级别降级为debug级别 - 减少生产环境中的冗余日志输出
This commit is contained in:
@@ -9,6 +9,11 @@ const config = {
|
||||
loads: [],//加载方式list
|
||||
},
|
||||
bgi_tools: {
|
||||
//授权token
|
||||
token: {
|
||||
name: 'Authorization',
|
||||
value: ''
|
||||
},
|
||||
api: {
|
||||
httpPullJsonConfig: undefined,
|
||||
httpPushAllJsonConfig: undefined,
|
||||
@@ -169,10 +174,14 @@ async function initConfig() {
|
||||
// config.user.physical.min = physical.min
|
||||
// 初始化uid
|
||||
config.user.uid = await ocrUid()
|
||||
const bgi_tools_token = settings.bgi_tools_token||"Authorization= "
|
||||
const list = Array.from(bgi_tools_token.split("=")).map(item=>item.trim());
|
||||
config.bgi_tools.token.name = list[0]
|
||||
config.bgi_tools.token.value = list[1]
|
||||
config.bgi_tools.api.httpPullJsonConfig = settings.bgi_tools_http_pull_json_config
|
||||
config.bgi_tools.api.httpPushAllJsonConfig = settings.bgi_tools_http_push_all_json_config
|
||||
config.bgi_tools.open.open_push = settings.bgi_tools_open_push
|
||||
log.info(`|bgi_tools:{1}`, JSON.stringify(config.bgi_tools))
|
||||
log.debug(`|bgi_tools:{1}`, JSON.stringify(config.bgi_tools))
|
||||
// const text = file.readTextSync(config.path.domain);
|
||||
// log.info("config.path.domain:{1}",config.path.domain)
|
||||
// log.info("text:{2}",text)
|
||||
|
||||
@@ -40,4 +40,11 @@
|
||||
"label": "bgi_tools推送全部配置api(去看文档)",
|
||||
"default": "http://127.0.0.1:8081/bgi/auto/plan/domain/json/all"
|
||||
}
|
||||
,
|
||||
{
|
||||
"name": "bgi_tools_token",
|
||||
"type": "input-text",
|
||||
"label": "bgi_tools授权token 语法:tokenName=tokenValue(去看文档)",
|
||||
"default": "Authorization= "
|
||||
}
|
||||
]
|
||||
@@ -1,4 +1,3 @@
|
||||
import {config} from "../config/config";
|
||||
|
||||
/**
|
||||
* 拉取对应uid的Json数据
|
||||
@@ -28,11 +27,14 @@ async function pullJsonConfig(uid, http_api) {
|
||||
* @param http_api
|
||||
* @returns {Promise<HttpResponse>}
|
||||
*/
|
||||
async function pushAllJsonConfig(list = [], http_api) {
|
||||
async function pushAllJsonConfig(list = [], http_api,token={name: "Authorization", value: ''}) {
|
||||
log.info(`list:{1},http:{2}`, list, http_api)
|
||||
const res = await http.request("POST", http_api, JSON.stringify({json: JSON.stringify(list)}), JSON.stringify({
|
||||
"Content-Type": "application/json"
|
||||
}))
|
||||
let value = {
|
||||
"Content-Type": "application/json",
|
||||
[token.name]: token.value
|
||||
};
|
||||
|
||||
const res = await http.request("POST", http_api, JSON.stringify({json: JSON.stringify(list)}), JSON.stringify(value))
|
||||
|
||||
log.debug(`[{0}]res=>{1}`, 'next', JSON.stringify(res))
|
||||
if (res.status_code === 200 && res.body) {
|
||||
|
||||
Reference in New Issue
Block a user