-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add Reqnroll.Microsoft.Extensions.Logging.ReqnrollPlugin #321
Conversation
Interesting idea. I'd like your thoughts on a related effort. We're considering adding use of Microsoft Logging internal to Reqnroll, to be used by Reqnroll maintainers and developers of Plugins, to obtain Trace and Debug-level output. This would be used to understand what's going on within the Reqnroll engine. The idea, though, is to steer such output away from the Test Framework's output stream (aka, avoid calling IReqnrollOutputHelper) so that the internal debug output doesn't interfere with the usual output of the Tests themselves. With that description, would you think your approach for this plugin would need to be different? |
Hello @Tiberriver256 and @gasparnagy, The idea for this PR is based on this project:
And I use this in my project to view the logging directly in the testoutput when running my tests locally, but specifically when running in Azure DevOps. I think that your approach of adding Microsoft Logging to Reqnroll is the other way around. |
This is definitely useful. I will have a busy week, so I can play with it only in the week after. I would like to keep this open until then. (So if we need further hotfix for v2.2 we can easier apply.) |
For using it internally the challenge is to have a specific version of Microsoft.Extensions.Logging.Abstractions bound to Reqnroll. E.g. If the project that is being tested uses Microsoft.Extensions.Logging.Abstractions 6.0, how much trouble we will cause if we force it to be 8.0. @StefH Do you know other tool similar to Reqnroll that use it internally and hence influence the dependencies of the product being tested? |
That's ok. |
In case you really want be most compatible, add the .NET 8.0 also as a framework and in that case use Microsoft.Extensions.Logging.Abstractions version 8. But I've another question: |
+1 on this as a way to handle it. I also believe, in general, it's recommended to target the oldest version possible in the compatibility list for a particular library. Microsoft generally tries to maintain compatibility as versions increase (e.g. 6.0 -> 8.0), but not necessarily the other way around if new features/types are introduced. So if Reqnroll can compile against Microsoft.Extensions.Logging.Abstractions v6.0, meaning it doesn't use any new features/types in 8.0, that's generally a better idea as it's much safer to redirect the version forward rather than backward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
I'm just thinking how we could somehow provide an even deeper support for the logging with this.
Could you please paste a sample code (e.g. a sample step definition class) that uses this logger? Based on that I might get some additional ideas.
@@ -0,0 +1,9 @@ | |||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="TaskFolder;TaskAssembly"> | |||
<ItemGroup> | |||
<None Include="$(_Reqnroll_MicrosoftExtensionsLoggingPluginPath)" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not a real Reqnroll "plugin", but just a library, do we still need to copy the assembly like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a real plugin indeed.
Should I remove this while file?
Example project can be found here: Example output in VS:
The |
@StefH Have you seen any "manual" usage of the logger without the MSDI? If yes, how would that usage look like? I am asking, because (as we discussed earlier) the usage of this with MSDI has problems with parallel execution. This is not because of the logging code (that is fine), but because of how the Reqnroll MSDI extension currently works. Maybe when the Reqnroll MSDI extension is updated, we can make this really a plugin and users would not even need to do the registration, so the usage will change and we would need to deal with that breaking change. When we include it, we should include it with the final usage version. The following options are in my mind:
What do you think? |
a] b] |
@StefH OK. Based on your first answer, I think I would include it now to the MSDI extension project, but do not advertise too much. I think this helps to consider this as a whole together with the MSDI extension, and also if someone wants to use it, they can. It is a useful piece of code anyway. Separating it is anyway easier than merging it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx. As discussed I proceed.
@StefH Thank you for the contribution! According to our guidelines I have invited you to the Reqnroll contributors team. Congrats! 🎉 If you accept it, you will be able to make pull requests easier in the future. You are also welcome on our discord server: https://go.reqnroll.net/discord-invite |
@gasparnagy |
Strange. For me it works. https://github.com/orgs/reqnroll/teams/contributors/members Maybe because you haven't accepted the invitation yet? |
Released in 2.3.0: https://github.com/reqnroll/Reqnroll/releases/tag/v2.3.0 |
🤔 What's changed?
As discussed here #247
I've created a new projects which cn be used to forward the logging from an ILogger to IReqnrollOutputHelper.
⚡️ What's your motivation?
#247
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
Initial code, please provide feedback.
And should this be called a "Plugin" because it does not actually implement IRuntimePlugin.
📋 Checklist: