console-to-file

1.0.1 • Public • Published

console-to-file

Logs console.log and console.error to an output text file

const ConsoleToFile = require("console-to-file");

var consoleToFile = new ConsoleToFile("/optional/folder/path"); // default is ./logs


console.log("Foo");
throw new Error("Fee");

// gets logged to 
// /optional/folder/path/11-10-2021 02-30-22 AM.log
// [11/10/2021 02:30:24 AM] [ 'Foo' ]
// [11/10/2021 02:32:15 AM] [
//   '(node:6744) UnhandledPromiseRejectionWarning: Error: Fee\n' +
//     '    at /your/script/path/test.js:33:8\n' +
//     '    at Module._compile (internal/modules/cjs/loader.js:1158:30)\n' +
//     '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)\n' +
//     '    at Module.load (internal/modules/cjs/loader.js:1002:32)\n' +
//     '    at Function.Module._load (internal/modules/cjs/loader.js:901:14)\n' +
//     '    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)\n' +
//     '    at internal/main/run_main_module.js:18:47'
// ]

Readme

Keywords

none

Package Sidebar

Install

npm i console-to-file

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • killerpokegames