修改系统日志时间打印

This commit is contained in:
whyour committed 2023-08-26 20:51:17 +08:00
1 parent b4e4e84bbd
commit 648b9c4520
5 files changed
+8 -21

No files matched your search

+4 -8
View File
@@ -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,
);
},