Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way for a program using an Sshnp to observe what is going on while sessions are being created #723

Closed
gkc opened this issue Jan 24, 2024 · 3 comments · Fixed by #741
Labels
enhancement New feature or request

Comments

@gkc
Copy link
Contributor

gkc commented Jan 24, 2024

Is your feature request related to a problem? Please describe.

We need a way to make sufficient info available to the app such that users have better visibility into what is going on while new sessions are being created

Describe the solution you'd like

Have Sshnp provide a way for programs to subscribe to a Stream of Strings, and have that stream yield Strings for all relevant events.

Describe alternatives you've considered

Bare minimum here could be to provide a way of listening to the logger; however the target audiences are slightly different. Having said that, providing a way to get programmatic access to a stream of messages from the logger may also be useful (e.g. if we were to provide users a way of creating support tickets based on something weird happening, then the logger info would be useful to us for more detailed diagnosis)

Additional context

No response

@gkc gkc added the enhancement New feature or request label Jan 24, 2024
@gkc
Copy link
Contributor Author

gkc commented Jan 25, 2024

@CurtlyCritchlow I'll get to this tomorrow; idea is (1) Sshnp will provide a method Stream<String> listenToProgress() which will emit Strings which are human readable; and (2) Sshnp will provide a methodStream<String> listenToLoggers() which will emit everything that is written to an AtSignLogger at or above the root log level

@gkc
Copy link
Contributor Author

gkc commented Jan 26, 2024

PR in next couple of hours

@gkc
Copy link
Contributor Author

gkc commented Jan 26, 2024

Created PR #741

@CurtlyCritchlow these methods have been added to the Sshnp interface

  /// Yields a string every time something interesting happens with regards to
  /// progress towards establishing the ssh connection.
  Stream<String>? get progressStream;

  /// Yields every log message that is written to [stderr]
  Stream<String>? get logStream;

FYI I added this for the CLI; what the GUI does will be quite different of course

      // A listen progress listener for the CLI
      // Will only log if verbose is false, since if verbose is true
      // there will already be a boatload of log messages
      logProgress(String s) {
        if (!(params?.verbose ?? true)) {
          stderr.writeln('${DateTime.now()} : $s');
        }
      }
      sshnp.progressStream?.listen((s) => logProgress(s));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant