日志模块拆分 category 参数:log.xxx(category, ...args) 输出 timestamp [level] [category]
- log.js 签名改为 log.xxx(category, ...args);头三段为时间戳 [level] [category],后续参数(含 Error/对象)透传 console 走 util.format
- 所有调用点迁移:从 log.info('[msg] xxx') → log.info('msg', 'xxx');server 启动行无前缀,统一归入 startup
- 实测输出:2026-09-05 09:27:12.068 [debug] [sse] task-20260904-012 event: ping
This commit is contained in:
@@ -66,8 +66,8 @@ router.post('/:id/files', upload.array('files', 10), function (req, res) {
|
||||
}
|
||||
// 不再自动通知 AI:附件随用户下一条消息统一告知(见 routes/messages.js 的 attachments)
|
||||
if (uploaded.length) {
|
||||
log.info('[file] ' + (req.user || '-') + ' ' + req.params.id + ' 上传 ' + uploaded.length + ' 个文件:' +
|
||||
uploaded.map(f => f.filename + '(' + f.size + 'B)').join('、'));
|
||||
log.info('file', (req.user || '-') + ' ' + req.params.id + ' 上传 ' + uploaded.length + ' 个文件:' +
|
||||
uploaded.map(f => f.filename + '(' + f.size + 'B)').join('、'));
|
||||
}
|
||||
res.json({ uploaded });
|
||||
} catch (err) {
|
||||
@@ -191,7 +191,7 @@ router.delete('/:id/files', function (req, res) {
|
||||
fs.rmSync(abs, { recursive: true, force: true });
|
||||
engine.getDb().prepare('DELETE FROM files WHERE session_id = ? AND filename = ?')
|
||||
.run(req.params.id, rel);
|
||||
log.info('[file] ' + (req.user || '-') + ' ' + req.params.id + ' 删除文件 ' + rel);
|
||||
log.info('file', (req.user || '-') + ' ' + req.params.id + ' 删除文件 ' + rel);
|
||||
res.json({ ok: true });
|
||||
} catch (err) {
|
||||
res.status(404).json({ error: '文件不存在' });
|
||||
|
||||
Reference in New Issue
Block a user