Uh oh!
There was an error while loading. Please reload this page.
Refactor logging to allow a loggerfactory per session - #1673
Conversation
…e ConnectionInfo. This commit introduces an `ILoggerFactory` to various classes, replacing the static logger factory with an instance-based approach for more flexible and session-specific logging. These changes improve the logging framework's flexibility and maintainability and allow unit testing of logging.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Rob-Hague
commented
Jul 21, 2025
ah and unfortunately a lot of the mocking tests are "strict" in that they expect every interface call to be declared. I think you can do whatever is easiest to get them working i.e. remove the strictness if it helps |
Uh oh!
There was an error while loading. Please reload this page.
desdesdes
commented
Jul 22, 2025
Removing the strictness and working around the null return would require a lot of ?? code in the library. So for now i chose the setup the logger everywhere. This create a lot of additions to the unit test, but I think this is the cleanest solution for now. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mus65
commented
Jul 24, 2025
mus65
commented
Jul 26, 2025
LGTM. I wrote a test case for this in a separate branch, but I'm not sure it's worth adding since it requires yet another dependency (test-only though). I would leave this up to @Rob-Hague . This imho makes SshNetLoggingConfiguration kind of obselete, but marking it obsolete after just introducing it doesn't seem sensible. 😄 |
Uh oh!
There was an error while loading. Please reload this page.
Rob-Hague
commented
Jul 26, 2025
That's a nice test to validate this change. I imagine it is less useful going forward (although perhaps moreso than some other tests...) |
Refactor logging to allow a loggerfactory per session specified in the ConnectionInfo.
This commit introduces an
ILoggerFactoryto various classes, replacing the static logger factory with an instance-based approach for more flexible and session-specific logging. These changes improve the logging framework's flexibility and maintainability and allow unit testing of logging.