-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adding a static factory for the TerminalLogger #11318
base: main
Are you sure you want to change the base?
Conversation
…er instance based on settings and terminal capabilities.
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
src/MSBuild/TerminalLogger/TerminalLogger.cs:1089
- [nitpick] The variable name 'tlArg' is ambiguous. It should be renamed to 'terminalLoggerArgument' for better readability.
string tlArg = args?.FirstOrDefault(a => a.StartsWith("--tl:", StringComparison.InvariantCultureIgnoreCase)) ?? string.Empty;
src/MSBuild/TerminalLogger/TerminalLogger.cs:1087
- Ensure that the new behavior introduced by the 'CreateTerminalOrConsoleLogger' method is covered by tests.
public static ILogger CreateTerminalOrConsoleLogger(LoggerVerbosity verbosity, string[]? args)
@baronfel, I know you would like to have full support for CLI logger configuration, but it will require some refactoring as the code for argument parsing is mostly placed in XMake. I wanted to break up XMake years ago, but now we have a valid reason to refactor at least part of the huge file :) If you don't mind, I would create a separate issue for this work. |
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.
LGTM, but should we use this factory in our own codebase to dogfood?
Yeah, that is quite a large unit of work - makes sense to carve it out. |
I wanted to do it from the beginning, but the entry point logic emits global messages when it detects that TL couldn't be used. The easiest solution is to make the list of deferred messages in I think we could move the factory to some already public type like Edit: I'm looking at |
Fixes #10998
Context
Although I created the SDK hotfix to always use the
ConsoleLogger
, we want to useTerminalLogger
when it's possible.Changes Made
Added a static factory that can return instance of Terminal or Console logger based on current environment. The usage of TerminalLogger in this scenario can be explicitly disabled by using of already existing env. variable or CLI argument
--tl:[on|off]
.This change also prevents emitting of progress indication when the verbosity is set to
quiet
.