Spaces:
Running
Running
v1.4.4 - Add platform, export count, language and per-format counts to backend log
Browse files- Show AI platform name, total export count, user language in first log line
- Show per-format export counts (PDF, MD, TXT, DOCX, JSON, Clipboard)
- ANSI color highlighting for each field
- Backward compatible with old plugin versions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
server.js
CHANGED
|
@@ -43,7 +43,19 @@ app.post('/api/generate_pdf', async (req, res) => {
|
|
| 43 |
const startTime = Date.now();
|
| 44 |
const envText = isTest ? '测试环境' : '生产环境';
|
| 45 |
const bgColor = isTest ? '\x1b[44m' : '\x1b[41m';
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
const getElapsed = () => ((Date.now() - startTime) / 1000).toFixed(2) + 's';
|
| 49 |
let browser = null;
|
|
|
|
| 43 |
const startTime = Date.now();
|
| 44 |
const envText = isTest ? '测试环境' : '生产环境';
|
| 45 |
const bgColor = isTest ? '\x1b[44m' : '\x1b[41m';
|
| 46 |
+
const { platform, exportCount, language, exportPdf, exportMd, exportTxt, exportDocx, exportJson, exportClipboard } = req.body;
|
| 47 |
+
const platformStr = platform ? `\x1b[36m${platform}\x1b[0m` : '\x1b[90munknown\x1b[0m';
|
| 48 |
+
const countStr = exportCount != null ? `\x1b[33m${exportCount}次\x1b[0m` : '\x1b[90m-\x1b[0m';
|
| 49 |
+
const langStr = language ? `\x1b[32m${language}\x1b[0m` : '\x1b[90m-\x1b[0m';
|
| 50 |
+
const fmtStr = [
|
| 51 |
+
exportPdf != null ? `PDF:${exportPdf}` : null,
|
| 52 |
+
exportMd != null ? `MD:${exportMd}` : null,
|
| 53 |
+
exportTxt != null ? `TXT:${exportTxt}` : null,
|
| 54 |
+
exportDocx != null ? `DOCX:${exportDocx}` : null,
|
| 55 |
+
exportJson != null ? `JSON:${exportJson}` : null,
|
| 56 |
+
exportClipboard != null ? `CLIP:${exportClipboard}` : null,
|
| 57 |
+
].filter(Boolean).join(', ');
|
| 58 |
+
console.log(`${bgColor}\x1b[37m[PDF-GEN] 收到 API 请求\x1b[0m | 环境: ${envText} | 平台: ${platformStr} | 导出: ${countStr} | ${fmtStr} | 语言: ${langStr}`);
|
| 59 |
|
| 60 |
const getElapsed = () => ((Date.now() - startTime) / 1000).toFixed(2) + 's';
|
| 61 |
let browser = null;
|