Repository navigation
[Declarative Config] Phase 24a: Apply self-diagnostics log level - #8101
stevejgordon wants to merge 1 commit into
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-11-10 12:43 UTC Respond to 4 review items (e.g. link a commit, explain why not, ask a follow-up): Status above doesn't look right?
|
90e2795 to
1319517
Compare
1319517 to
040dbe4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8101 +/- ##
==========================================
- Coverage 93.09% 93.08% -0.01%
==========================================
Files 397 401 +4
Lines 23335 23809 +474
Branches 4359 4500 +141
==========================================
+ Hits 21724 22163 +439
- Misses 1103 1119 +16
- Partials 508 527 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
|
040dbe4 to
2cb24f4
Compare
Assisted-by: OpenAI Codex (GPT-Sol 6.1) Assisted-by: Claude Code (Opus 5.5)
2cb24f4 to
5466bb0
Compare
| internal static LogLevel ToLogLevel(this SeverityNumber severity) => severity switch | ||
| { | ||
| <= SeverityNumber.Trace4 => LogLevel.Trace, | ||
| <= SeverityNumber.Debug4 => LogLevel.Debug, | ||
| <= SeverityNumber.Info4 => LogLevel.Information, | ||
| <= SeverityNumber.Warn4 => LogLevel.Warning, | ||
| <= SeverityNumber.Error4 => LogLevel.Error, | ||
| _ => LogLevel.Critical, | ||
| }; |
There was a problem hiding this comment.
Should we explicitly handle default(SeverityNumber) somehow, as that's not a defined value in the enum?
| YamlScalarKind.String => ModelProperty<SeverityNumber>.Create( | ||
| SeverityNumberParser.Parse(YamlKeys.LogLevel, resolved.Value, valueNode.Start)), |
There was a problem hiding this comment.
Slightly more readable IMHO.
| YamlScalarKind.String => ModelProperty<SeverityNumber>.Create( | |
| SeverityNumberParser.Parse(YamlKeys.LogLevel, resolved.Value, valueNode.Start)), | |
| YamlScalarKind.String => ModelProperty<SeverityNumber>.Create(SeverityNumberParser.Parse(YamlKeys.LogLevel, resolved.Value, valueNode.Start)), |
| new($"'{key}' {Describe(position)} must be a string, but is a {actual} value. Allowed values are: {AllowedValues}."); | ||
|
|
||
| private static string Describe(Mark position) => | ||
| $"at line {position.Line.ToString(CultureInfo.InvariantCulture)}, column {position.Column.ToString(CultureInfo.InvariantCulture)}"; |
There was a problem hiding this comment.
| $"at line {position.Line.ToString(CultureInfo.InvariantCulture)}, column {position.Column.ToString(CultureInfo.InvariantCulture)}"; | |
| FormattableString.Invariant($"at line {position.Line}, column {position.Column}"); |
| var severities = new Dictionary<string, SeverityNumber>(24, StringComparer.Ordinal); | ||
| foreach (var severity in Enum.GetValues<SeverityNumber>()) | ||
| { | ||
| severities[severity.ToString().ToLowerInvariant()] = severity; | ||
| } | ||
|
|
||
| return severities.ToFrozenDictionary(StringComparer.Ordinal); | ||
| } | ||
| #else | ||
| private static Dictionary<string, SeverityNumber> BuildSeverities() | ||
| { | ||
| var severities = new Dictionary<string, SeverityNumber>(24, StringComparer.Ordinal); |
There was a problem hiding this comment.
Make the 24 a constant and cross reference the need to update it in a comment in the enum if more ever get added?
Contibutes to #7658
Changes
Apply the root
log_levelto SDK self-diagnostics, validating all 24 lowercase schema values and mapping them to .NET logging levels. Preserve code-based overrides and the document threshold across configuration reloads. Setting the level does not enable diagnostic output.Merge requirement checklist
CHANGELOG.mdfile(s) updated for non-trivial changesChanges in public API reviewed (if applicable)Note
The implementation and this PR description were prepared with GitHub CoPilot (GPT-Sol 6.1) and Claude Code (Opus 5.5)