UNPKG

posix-node

Version:

Missing Posix Functions for Node.js (via a native module written in Zig)

32 lines (29 loc) 1.2 kB
"use strict"; /* Initialize debug logging. We use the standard debug logger with name "posix-node": https://www.npmjs.com/package/debug DEBUG_FILE option: To log to a file instead *also* set the env variable DEBUG_FILE to that filename. You need to log to a file in case you're debugging something that forks and doesn't have stdout/stderr anymore. Also, we do NOT reset the contents of the file and instead always append, because forking would be a problem, where the forked process might delete the file in the middle of the run. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.log = void 0; const debug_1 = __importDefault(require("debug")); const util_1 = require("util"); const fs_1 = require("fs"); if (process.env.DEBUG_FILE) { const debugFilename = process.env.DEBUG_FILE; debug_1.default.log = (...args) => { const s = (0, util_1.format)(...args); (0, fs_1.appendFileSync)(debugFilename, s + "\n"); }; } exports.log = (0, debug_1.default)("posix-node"); //# sourceMappingURL=logging.js.map