From c291b18def8def40260fbc19d1183f5201735fdb Mon Sep 17 00:00:00 2001 From: kj415j45 <919815238@qq.com> Date: Wed, 6 Sep 2023 18:00:42 +0800 Subject: [PATCH] Better insert timestamp. --- src/controller/get.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/get.ts b/src/controller/get.ts index d164c4b..b458919 100644 --- a/src/controller/get.ts +++ b/src/controller/get.ts @@ -3,7 +3,7 @@ export default async function get(env: Env, id: string, withTimestamp = false): return ( await env.DB.prepare('SELECT timestamp, message FROM log WHERE endpoint = ? ORDER BY timestamp ASC LIMIT -1 OFFSET 1').bind(id).all() ).results - .map((r) => `${new Date(r.timestamp as number).toISOString()} ${r.message}`) + .map((r) => (r.message as string).replace(/^/gm, new Date(r.timestamp as number).toISOString() + ' ')) .join('\n'); } else { return (