fix: logger
This commit is contained in:
parent
50b2a23ee0
commit
2d3f52c69e
@ -2,6 +2,7 @@ const { exit } = require("process")
|
||||
const fs = require("fs")
|
||||
const nodemailer = require('nodemailer')
|
||||
const { default: axios } = require("axios")
|
||||
const { log } = require("./logger")
|
||||
|
||||
exports.NotificationURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true'
|
||||
exports.WalletURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get'
|
||||
|
20
src/index.js
20
src/index.js
@ -5,22 +5,8 @@ const reggol = require("reggol")
|
||||
const { getConfigs, checkConfigs, makeHeader, Notification, Wallet, SendLog, AppVersion, getGlobalConfig } = require("./config")
|
||||
const urlconfig = require("./config")
|
||||
|
||||
const nodemailer = require('nodemailer')
|
||||
|
||||
const baseLogger = new reggol("GenshinCloudPlayHelper")
|
||||
var logContent = ``
|
||||
|
||||
const log = {
|
||||
info(content){
|
||||
logContent += `<strong style="color: green">[info]</strong> ${content}<br>`
|
||||
baseLogger.info(content)
|
||||
},
|
||||
error(content){
|
||||
logContent += `<strong style="color: red">[error]</strong> ${content}<br>`
|
||||
baseLogger.error(content)
|
||||
}
|
||||
}
|
||||
|
||||
const { log } = require("./logger")
|
||||
(async () => {
|
||||
log.info("开始获取全局配置")
|
||||
var globalConfig = getGlobalConfig();
|
||||
log.info("获取成功")
|
||||
@ -41,8 +27,6 @@ var configs = getConfigs();
|
||||
log.info(`正在检测配置有效性`)
|
||||
checkConfigs(configs)
|
||||
log.info("检测完毕!")
|
||||
|
||||
(async () => {
|
||||
log.info("正在获取版本号")
|
||||
var appversion = await AppVersion();
|
||||
appversion = appversion.data.package_version
|
||||
|
13
src/logger.js
Normal file
13
src/logger.js
Normal file
@ -0,0 +1,13 @@
|
||||
const baseLogger = new reggol("GenshinCloudPlayHelper")
|
||||
var logContent = ``
|
||||
|
||||
exports.log = {
|
||||
info(content){
|
||||
logContent += `<strong style="color: green">[info]</strong> ${content}<br>`
|
||||
baseLogger.info(content)
|
||||
},
|
||||
error(content){
|
||||
logContent += `<strong style="color: red">[error]</strong> ${content}<br>`
|
||||
baseLogger.error(content)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user