UNPKG

506 BJavaScriptView Raw
1const readline = require("readline");
2
3let logStream = process.stdout;
4
5function write(data) {
6 process.stdout.write(data);
7}
8
9function log(data = "", end = "\n") {
10 logStream.write(data + end);
11}
12
13function clear() {
14 readline.clearLine(process.stdout, -1);
15 readline.cursorTo(process.stdout, 0, null);
16}
17
18function startDebug() {
19 logStream = process.stderr;
20}
21
22function getLogStream() {
23 return logStream;
24}
25
26module.exports = {write, log, clear, startDebug, getLogStream};