Skip to content

Commit

Permalink
Better insert timestamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
kj415j45 committed Sep 6, 2023
1 parent 5d9b7b0 commit c291b18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controller/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit c291b18

Please sign in to comment.