From 7dd87220abf7e88d68247888c861c4defd805e41 Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 25 Feb 2022 23:06:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9public=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/config/util.ts | 2 +- back/public.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/back/config/util.ts b/back/config/util.ts index 174ec9ea..f3763426 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -107,7 +107,7 @@ export function createRandomString(min: number, max: number): string { newArr.push(arr.splice(Math.random() * arr.length, 1)[0]); } - function getOne(arr) { + function getOne(arr: any[]) { return arr[Math.floor(Math.random() * arr.length)]; } diff --git a/back/public.ts b/back/public.ts index 34b99aee..4bcc13a5 100644 --- a/back/public.ts +++ b/back/public.ts @@ -6,12 +6,15 @@ import config from './config'; const app = express(); app.get('/api/public/panel/log', (req, res) => { - exec('pm2 logs panel --lines 500', (err, stdout, stderr) => { - if (err || stderr) { - return res.send({ code: 400, data: err || stderr }); - } - return res.send({ code: 200, data: stdout }); - }); + exec( + 'pm2 logs panel --lines 500 --nostream --timestamp', + (err, stdout, stderr) => { + if (err || stderr) { + return res.send({ code: 400, data: err || stderr }); + } + return res.send({ code: 200, data: stdout }); + }, + ); }); app