| 1234567891011121314151617181920212223242526 |
- import { readLines } from "https://deno.land/std@0.83.0/io/mod.ts";
- interface LogEntry {
- log: string;
- stream: "stdout";
- time: Date;
- }
- const encoder = new TextEncoder();
- const filenames = Deno.args;
- for (const filename of filenames) {
- const file = await Deno.open(filename);
- for await (const line of readLines(file)) {
- if (line) {
- const parsedLine = JSON.parse(
- line,
- (key, value) => key === "time" ? new Date(value) : value,
- ) as LogEntry;
- await Deno.stdout.write(
- encoder.encode(`${parsedLine.time.toISOString()} ${parsedLine.log}`),
- );
- }
- }
- file.close();
- }
|