Skip to content

Instantly share code, notes, and snippets.

@dbwodlf3
Created April 25, 2024 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbwodlf3/cc2da275db08c0a9f2f6b7d5e40840c8 to your computer and use it in GitHub Desktop.
Save dbwodlf3/cc2da275db08c0a9f2f6b7d5e40840c8 to your computer and use it in GitHub Desktop.
node debugging with file log
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'); // 표준 출력에도 쓰기
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment