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

Avoid repeated messages in Output window of IDE? #34

Open
DennisWelu opened this issue Apr 2, 2024 · 0 comments
Open

Avoid repeated messages in Output window of IDE? #34

DennisWelu opened this issue Apr 2, 2024 · 0 comments

Comments

@DennisWelu
Copy link

DennisWelu commented Apr 2, 2024

I've noticed when running Debug builds that each enabled logger is sending its output to the Output window in Visual Studio. So you end with double or multiple of the same output e.g. here is the output with both the AddTraceLogger and AddInMemoryLogger configured:

19|2024-04-02T18:16:19.5288469+00:00|TRACE|1|CreateLogger FlyoutMenuViewModel
20|2024-04-02T18:16:19.5308830+00:00|TRACE|1|Created Logger 'FlyoutMenuViewModel'
21|2024-04-02T18:16:19.5320016+00:00|TRACE|1|CreateLogger FlyoutMenuViewModel
22|2024-04-02T18:16:19.5330669+00:00|TRACE|1|Created Logger 'FlyoutMenuViewModel'

This creates extra noise to sort through in the output window. Am I missing something that controls this in the configuration? Or could there be something added to address it?

Here is how I have it configured:

		builder.Logging
			.SetMinimumLevel(LogLevel.Trace) // IMPORTANT: set the overall minimum log level else individual logger filters may not work
#if DEBUG
			.AddTraceLogger(options => // Writes to the Debug output
			{
				options.MinLevel = LogLevel.Trace;
				options.MaxLevel = LogLevel.Critical;
			})
#endif
			.AddInMemoryLogger(options => // Write to memory in support of displaying events in a UI
			{
				options.MaxLines = 1024;
				options.MinLevel = LogLevel.Debug;
				options.MaxLevel = LogLevel.Critical;
			});

Actually looking at this now I see the memory logger MinLevel is supposed to be Debug but the output is still showing Trace messages. Hmm.

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

No branches or pull requests

1 participant