Skip to content
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

Reuse ClassLoggers #7509

Merged
merged 4 commits into from
Sep 30, 2024
Merged

Reuse ClassLoggers #7509

merged 4 commits into from
Sep 30, 2024

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Sep 29, 2024

Changes

  • Reuse ClassLoggers via ConcurrentDictionary like Typed loggers
  • Uses [CallerFilePath] for a compile time lookup to avoid using StackTrace to stack walk

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

@benaadams benaadams changed the title Reuse ClassLoggers avoid using StackTrace to create Reuse ClassLoggers Sep 29, 2024
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't want to have logger per instance?

@benaadams
Copy link
Member Author

So we don't want to have logger per instance?

Doesn't really matter; is a logger per type that we want. The typed version GetClassLogger<T>() already has this cache on Type so is just adding it for string also

@benaadams benaadams merged commit 471412a into master Sep 30, 2024
66 checks passed
@benaadams benaadams deleted the logging-reuse branch September 30, 2024 10:47
brbrr pushed a commit that referenced this pull request Sep 30, 2024
rjnrohit pushed a commit that referenced this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants