Comments (7)
Okay, so this is what I've been running into on this:
As Node is single-threaded, it's hard to duplicate transparent sessions (though I totally agree) in terms of sorting through stdout
.
The only way I can think of doing this is to require logging on all vantage.command(...).action()
actions to use Vantage's own logging method, i.e. this.log
, or this.warn
, or this.error
. In this way, the logging can stay in that session's 'domain' and then I can accomplish perfect transparency (with an option for piping, as you went over).
I've gone back and forth on this several times in the past two weeks, as requiring users remember to use vantage.log
for proper functionality seems like it has something wrong with it. I could be wrong.
Any input you have on the matter is appreciated.
from vantage.
BTW, a REPL vantage extension is coming soon... with an additional bonus...
from vantage.
As Node is single-threaded, it's hard to duplicate transparent sessions (though I totally agree) in terms of sorting through stdout.
Oh, sorry, I don't follow, can you please elaborate?
from vantage.
Sure.
Say your remote vantage server has this command:
vantage.command('foo')
.action(function(args, cb){
console.log('foo');
cb();
});
Now, suppose 3 clients log in to this server at the same time. Client 2 runs foo
. Remote server throws foo
to stdout
.
We can do a few things here:
- Log foo on the remote tty (don't eat it),
- Pipe foo back to all 3 sessions logged in.
What we can't do is:
- Only pipe foo back to the session that originated it,
- Log other logging originated (disassociated with vantage) on the remote tty, while skipping the logging of foo on the remote tty.
In other words, the remote server has no way of knowing who originated what logging, as all stdout is on a single thread. When a vantage action runs, I know who is running the action, so if you used this.log
(vantage being this
), I could get smart and discern what logging originated from Vantage.
So there's a few ways to do this, but I'm not sure what the best way is.
Does that make any more sense? If I'm totally misduplicating your issue, just let me know.
from vantage.
makes sense, not sure the answer. I guess reason i opened this issue was that the current behaviour was surprising.
from vantage.
Don't worry - it was a good point. Mid a large refactor (https://github.com/dthree/vantage/tree/authentication) which is doing a thorough fix on the whole subject you brought up. I'll let you know when it's good to go.
from vantage.
Finished session refactor - all logging now goes through this.log
(added details in docs), and the behavior is as you would expect.
Otherwise, many other updates were completed including authentication, and Vantage is production ready at 1.0! Hope you have a change to try it out.
from vantage.
Related Issues (20)
- Problem with exit command HOT 3
- Command arguments HOT 2
- [Question] How well does this interop with process managers like PM2? [eom] HOT 1
- vantage-auth-basic missing HOT 1
- several build errors HOT 5
- Can't get auth to work HOT 1
- Listen callback does not fire until first connection HOT 1
- Improve/correct project description
- Canβt use `.types` HOT 2
- Support multiple HapiJS connections HOT 2
- start boot
- Allow banner to be a function so banner can change depending on app state, or environment state
- Update to latest vorpal
- Release a new package HOT 4
- In the tour REPL, arrow up key loads 2nd latest command
- TypeError: vantage._pause is not a function HOT 2
- Command definition - when 0 is given as a argument, it's not recognized
- Vantage Command Missing Number Data HOT 1
- How to exit from vantage? HOT 2
- vorpal version in package that npm installs different from one in repository
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vantage.