-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
Tracing levels and actual trace event Ids #738
base: develop
Are you sure you want to change the base?
Conversation
Fix event ids, they are supposed to be unique identifiers per trace event message, not a thread identifier. Implemented trace event levels ("types") Used string interpolation as part of modern C# coding practices. Made diagnostic class and trace source public so library consumers may register listeners to the source. Git ignore hidden VS 2019 folder. Re-ordered out of order using declarations.
Most of these changes should be reverted:
I also don't like these "magic" event ids. Perhaps consider using an internal enum for this? |
SSH .NET targets Framework 3.5 as the oldest, and all framework version are compatible with C# version 7.3 per https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version#defaults |
Because the trace source Listeners needs to be accessible to enable programmatically adding listeners. See examples in public doc: https://docs.microsoft.com/en-us/dotnet/framework/debug-trace-profile/how-to-create-and-initialize-trace-sources#to-initialize-trace-sources-listeners-and-filters-without-a-configuration-file
|
Yes "magic" event ids are not ideal. I agree that an enum is the best way to address that. I will add an enum for trace event ids. It will also become handy if we latter either upgrade or supplement trace source with a modern ETW event source (they also use unique id per event). |
@drieseng could you take a new look at this? |
@drieseng ping for review / next step |
@drieseng I noticed you are active today. Could you review the answers here? |
I have to use VS 2012 to build some of our older target frameworks (Silverlight, WP7). |
I left some remarks in my latest review.
I know these last two remarks are problematic, but I'd like to discuss and review these in more detail. |
Ok, applied all 3 of these asks. For modernization, I recommend replacing this legacy trace with The per event type methods would look something like:
For convenience I typically add a lazy-initialized singleton like that:
There is an EventSource User's Guide by Cosmin Radu and Vance Morrison, architects from the .NET team, on this topic. |
@daviburg Can you refresh this PR? We've already removed old .NET Frameworks. |
Fix event ids, they are supposed to be unique identifiers per trace event message, not a thread identifier.
Implemented trace event levels ("types")
Git ignore hidden VS 2019 folder.
Re-ordered out of order using declarations.