Skip to content

Instantly share code, notes, and snippets.

@dbwodlf3
Created April 25, 2024 04:38
Show Gist options
  • Select an option

  • Save dbwodlf3/cc2da275db08c0a9f2f6b7d5e40840c8 to your computer and use it in GitHub Desktop.

Select an option

Save dbwodlf3/cc2da275db08c0a9f2f6b7d5e40840c8 to your computer and use it in GitHub Desktop.

Revisions

  1. dbwodlf3 created this gist Apr 25, 2024.
    9 changes: 9 additions & 0 deletions log.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    import fs from "fs";
    import util from "util";

    const logFile = fs.createWriteStream('output.log', { flags: 'a' });

    console.log = function (msg) {
    logFile.write(util.format(msg) + '\n'); // 메시지를 파일에 쓰기
    process.stdout.write(util.format(msg) + '\n'); // 표준 출력에도 쓰기
    };