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