修改系统日志时间打印

This commit is contained in:
whyour
2023-08-26 20:51:17 +08:00
parent b4e4e84bbd
commit 648b9c4520
5 changed files with 8 additions and 21 deletions
+1 -3
View File
@@ -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);
}
+2 -4
View File
@@ -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,
);
});