Coder Social home page Coder Social logo

Comments (7)

dthree avatar dthree commented on June 15, 2024

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.

dthree avatar dthree commented on June 15, 2024

BTW, a REPL vantage extension is coming soon... with an additional bonus...

from vantage.

timoxley avatar timoxley commented on June 15, 2024

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.

dthree avatar dthree commented on June 15, 2024

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:

  1. Log foo on the remote tty (don't eat it),
  2. Pipe foo back to all 3 sessions logged in.

What we can't do is:

  1. Only pipe foo back to the session that originated it,
  2. 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.

timoxley avatar timoxley commented on June 15, 2024

makes sense, not sure the answer. I guess reason i opened this issue was that the current behaviour was surprising.

from vantage.

dthree avatar dthree commented on June 15, 2024

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.

dthree avatar dthree commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.