Skip to content

[Log]: honor global LogParameters/NoLog when aspect comes from Apply rule#8

Merged
MistyKuu merged 1 commit intomasterfrom
claude/fix-logging-parameters-x1rJR
Apr 21, 2026
Merged

[Log]: honor global LogParameters/NoLog when aspect comes from Apply rule#8
MistyKuu merged 1 commit intomasterfrom
claude/fix-logging-parameters-x1rJR

Conversation

@MistyKuu
Copy link
Copy Markdown
Owner

The [Log] source generator had two resolution holes that silently let
parameter values through even when the user asked for them to be redacted:

  1. LogClassDataProvider.ExtractClassData only returned defaults if the
    class had a method-level [Log] attribute, so global settings like
    ILogConfigurator.Defaults(d => d.LogParameters = false) were dropped
    whenever [Log] was applied via b.Apply(...) or a
    class-level [Log]. The emitter then fell back to the hardcoded true.

  2. ParseInterfaceProxy built the method model from openMethod.Parameters,
    so [NoLog] / [Sensitive] / [return: NoLog] declared on the concrete
    impl were invisible to the synthesized interface proxy. Calls made
    through the interface reference logged data the impl had redacted.

Fixes:

  • LogClassDataProvider now also detects class-level [Log] and any method
    matched by an Apply rule in IAopConfigurator.
  • BuildMethodModel, CollectAspects and CollectVirtualAspect accept an
    optional attributeOverlay method; ParseInterfaceProxy passes the
    resolved impl so its parameter and return-type attributes are unioned
    with the interface's own.
  • Documented resolution order (method > class > Apply-config > global
    Defaults > hardcoded) in a CollectAspects doc comment.

Tests cover Apply(selector, configure) with LogParameters=false, and
[NoLog] on both the interface and impl parameter when dispatched through
the interface.

https://claude.ai/code/session_01AgEzrm85raXE4PpBueGsbM

@MistyKuu MistyKuu force-pushed the claude/fix-logging-parameters-x1rJR branch 2 times, most recently from 896a864 to 6afb703 Compare April 21, 2026 06:37
…rule

The [Log] source generator had two resolution holes that silently let
parameter values through even when the user asked for them to be redacted:

1. LogClassDataProvider.ExtractClassData only returned defaults if the
   class had a method-level [Log] attribute, so global settings like
   ILogConfigurator.Defaults(d => d.LogParameters = false) were dropped
   whenever [Log] was applied via b.Apply<LogAttribute>(...) or a
   class-level [Log]. The emitter then fell back to the hardcoded `true`.

2. ParseInterfaceProxy built the method model from openMethod.Parameters,
   so [NoLog] / [Sensitive] / [return: NoLog] declared on the concrete
   impl were invisible to the synthesized interface proxy. Calls made
   through the interface reference logged data the impl had redacted.

Fixes:
- LogClassDataProvider now also detects class-level [Log] and any method
  matched by an Apply<LogAttribute> rule in IAopConfigurator.
- BuildMethodModel, CollectAspects and CollectVirtualAspect accept an
  optional attributeOverlay method; ParseInterfaceProxy passes the
  resolved impl so its parameter and return-type attributes are unioned
  with the interface's own.
- Documented resolution order (method > class > Apply-config > global
  Defaults > hardcoded) in a CollectAspects doc comment.

Tests cover Apply(selector, configure) with LogParameters=false, and
[NoLog] on both the interface and impl parameter when dispatched through
the interface.

Co-Authored-By: Claude <noreply@anthropic.com>
@MistyKuu MistyKuu force-pushed the claude/fix-logging-parameters-x1rJR branch from 6afb703 to ca3e202 Compare April 21, 2026 06:38
@MistyKuu MistyKuu merged commit 95b7bc4 into master Apr 21, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant