Skip to content

Refactor: structured logging and async best practices#39

Merged
Sarmkadan merged 1 commit into
mainfrom
refactor/improve-error-handling
May 21, 2026
Merged

Refactor: structured logging and async best practices#39
Sarmkadan merged 1 commit into
mainfrom
refactor/improve-error-handling

Conversation

@Sarmkadan

Copy link
Copy Markdown
Owner

Summary

  • Replace $"...{var}..." string interpolation in ILogger calls with structured logging message templates
  • Add ConfigureAwait(false) to async calls in library/service code (non-controller, non-middleware)

Motivation

Structured logging: String interpolation causes unnecessary allocations when log level is disabled, and prevents log aggregation tools (Seq, ELK, Application Insights) from extracting parameters.

ConfigureAwait(false): Library code should not capture the synchronization context. Missing ConfigureAwait(false) can cause deadlocks when library methods are called from synchronous-over-async code paths.

Risk Assessment

  • Zero behavior change - only logging format and async context capture affected
  • All log messages retain identical human-readable output

- Replace string interpolation in ILogger calls with structured
  logging message templates for better log aggregation and to avoid
  unnecessary string allocations when log level is disabled
- Add ConfigureAwait(false) to async calls in library/service code
  to prevent potential deadlocks in synchronous-over-async contexts

 27 files changed, 260 insertions(+), 260 deletions(-)
@Sarmkadan
Sarmkadan merged commit 3296cc3 into main May 21, 2026
Sarmkadan added a commit that referenced this pull request Jul 11, 2026
Refactor: structured logging and async best practices
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