mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改系统日志时间打印
This commit is contained in:
parent
b4e4e84bbd
commit
648b9c4520
|
@ -33,9 +33,7 @@ const addCron = (
|
|||
id,
|
||||
nodeSchedule.scheduleJob(id, schedule, async () => {
|
||||
Logger.info(
|
||||
`[schedule][准备运行任务] 时间: ${dayjs().format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)},运行命令: ${cmdStr}`,
|
||||
`[schedule][准备运行任务] 命令: ${cmdStr}`,
|
||||
);
|
||||
runCron(`ID=${id} ${cmdStr}`);
|
||||
}),
|
||||
|
|
|
@ -66,9 +66,8 @@ export default class ScheduleService {
|
|||
|
||||
cp.stderr.on('data', async (data) => {
|
||||
this.logger.info(
|
||||
'[执行任务失败] %s, 时间: %s, 错误信息: %j',
|
||||
'[执行任务失败] 命令: %s, 错误信息: %j',
|
||||
command,
|
||||
new Date().toLocaleString(),
|
||||
data.toString(),
|
||||
);
|
||||
await callbacks.onError?.(data.toString());
|
||||
|
@ -76,9 +75,8 @@ export default class ScheduleService {
|
|||
|
||||
cp.on('error', async (err) => {
|
||||
this.logger.error(
|
||||
'[创建任务失败] %s, 时间: %s, 错误信息: %j',
|
||||
'[创建任务失败] 命令: %s, 错误信息: %j',
|
||||
command,
|
||||
new Date().toLocaleString(),
|
||||
err,
|
||||
);
|
||||
await callbacks.onError?.(JSON.stringify(err));
|
||||
|
@ -101,9 +99,8 @@ export default class ScheduleService {
|
|||
});
|
||||
} catch (error) {
|
||||
await this.logger.error(
|
||||
'[执行任务失败] 命令: %s, 时间: %s, 错误信息: %j',
|
||||
'[执行任务失败] 命令: %s, 错误信息: %j',
|
||||
command,
|
||||
new Date().toLocaleString(),
|
||||
error,
|
||||
);
|
||||
await callbacks.onError?.(JSON.stringify(error));
|
||||
|
@ -167,9 +164,8 @@ export default class ScheduleService {
|
|||
},
|
||||
(err) => {
|
||||
this.logger.error(
|
||||
'[执行任务失败] 命令: %s, 时间: %s, 错误信息: %j',
|
||||
'[执行任务失败] 命令: %s, 错误信息: %j',
|
||||
command,
|
||||
new Date().toLocaleString(),
|
||||
err,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -37,9 +37,7 @@ class TaskLimit {
|
|||
|
||||
public runWithCpuLimit<T>(fn: () => Promise<T>): Promise<T> {
|
||||
Logger.info(
|
||||
`[schedule][任务加入队列] 时间: ${dayjs().format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)}, 运行中任务数: ${this.cpuLimitActiveCount}, 等待中任务数: ${this.cpuLimitPendingCount}`,
|
||||
`[schedule][任务加入队列] 运行中任务数: ${this.cpuLimitActiveCount}, 等待中任务数: ${this.cpuLimitPendingCount}`,
|
||||
);
|
||||
return this.cpuLimit(fn);
|
||||
}
|
||||
|
|
|
@ -11,17 +11,15 @@ export function runCron(cmd: string): Promise<number> {
|
|||
|
||||
cp.stderr.on('data', (data) => {
|
||||
Logger.info(
|
||||
'[schedule][执行任务失败] %s, 时间: %s, 错误信息: %j',
|
||||
'[schedule][执行任务失败] 命令: %s, 错误信息: %j',
|
||||
cmd,
|
||||
new Date().toLocaleString(),
|
||||
data.toString(),
|
||||
);
|
||||
});
|
||||
cp.on('error', (err) => {
|
||||
Logger.error(
|
||||
'[schedule][创建任务失败] %s, 时间: %s, 错误信息: %j',
|
||||
'[schedule][创建任务失败] 命令: %s, 错误信息: %j',
|
||||
cmd,
|
||||
new Date().toLocaleString(),
|
||||
err,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -252,9 +252,6 @@ const Setting = () => {
|
|||
})
|
||||
.then(async (res) => {
|
||||
setSystemLogData(await res.text());
|
||||
setTimeout(() => {
|
||||
getSystemLog();
|
||||
}, 5000);
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.log(error);
|
||||
|
|
Loading…
Reference in New Issue
Block a user