vorpal
vorpal copied to clipboard
Improve logging
Currently logging is only a simple log
command. This has to be improved somehow, as it's too limiting. For instance, I can't log two things on the same line (Starting compilation... DONE
).
The most versatile solution is probably just to expose a WritableStream
, then other logging functionality can be built on top of that.
what kind of logging? debugging logging?
No. Output to the console logging. As in, when I'm writing a console application, I would like to be able to output things to the console.
sorry then you are going to have to be more specific, as in, what is wrong with console.log()
Well, it's a bit hard to answer after months of not looking at vorpal, but IIRC the issue is that vorpal uses custom streams of output for the commands. It has its own stdout/stdin, which allows you to do piping within vorpal. Whether or not console.log
works or not, I don't remember. But I do remember that I couldn't use console.log
, because it inserts a newline at the end, and I needed to be able to print things that doesn't include a newline.
right, so try process.stdout.write('foo')
if you don't want a newline.
console.log()
/ process.stdout.write()
will work with Vorpal
if you want something to go to the terminal, it usually has to go to process.stdout
or process.stderr
in the end anyway
Not if you're doing internal piping. Then it has to be redirected to the next command.
best to show some code demonstrating the problem at this point
Yeah, as said, I don't even have the project I had this problem with anymore. This was the main reason I changed away from vorpal. But, if I recall correctly the issue is as following:
If you create 2 commands in vorpal, let's call them write
and read
. write
writes to stdout, whereas read
reads from stdin. Then you launch the vorpal interactive mode, and you type in write | read
. The issue is that I need to output content that does not end in a linefeed from write
, that is then read by read
.