Enable Loggers to retrieve run-time state of LoggingService to configure their own behaviors
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
It is very odd that loggers like BinaryLogger need to set environment variables and change the Traits' state. There are two aspects of logger configuration that need coordination:
* _requirements_ of the various loggers - for example, TerminalLogger and BinaryLogger both need Target outputs to be enabled. The presence of either of those loggers should cause the LoggingService to force that feature to enabled
* _optional behaviors_ of various loggers - for example, the Console logger checks the Traits to see if it should render specific kinds of additional data
I think we have a mismatch here that needs two things to happen to fix it:
* The requirements from the first category are not uniformly enforced by the LoggingService configuration/initialization. To fix this we need to push more logic into the BuildParameters and friends.
* The optional features from the second category are not _communicated_ to the loggers at their run-time. They are forced to read the Traits, which are mutable and may not be kept up to date as other components change them. To fix this, we need a way to communicate the various flags on the LoggingService (but probably not through that LoggingService directly) at run-time to the Loggers - probably through Initialize?
_Originally posted by @baronfel in https://github.com/dotnet/msbuild/pull/12082#discussion_r2254530081_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.