Created
March 10, 2025 03:11
-
-
Save guiseek/b24255345156d1dcfc2b69276d9b31fe to your computer and use it in GitHub Desktop.
NodeJS Console Table Logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createWriteStream, PathLike } from "node:fs"; | |
import { Console } from "node:console"; | |
export const logger = <T>(path: PathLike, data: T[]) => { | |
const stream = createWriteStream(path); | |
const console = new Console(stream); | |
console.table(data); | |
stream.end(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment