UNPKG

pinetto

Version:

Isomorphic, opinionated logging library focusing on simplicity and readability. Supports child loggers.

25 lines 649 B
import { EOL, IS_NODE } from '../constants.js'; const getStream = (stream) => { switch (stream) { case 'stdout': return process.stdout; case 'stderr': return process.stderr; default: return stream; } }; export class ProcessWriter { #stream; constructor(stream = 'stdout') { if (!IS_NODE) { throw new Error('Cannot use ProcessWriter(): Node.js not detected'); } this.#stream = getStream(stream); } write(entry) { this.#stream.write(entry); this.#stream.write(EOL.value); } } //# sourceMappingURL=process.js.map