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

Feature Request: Extend InternalLogger methods to take lamda parameters and only invoke these if the appropriate log level is enabled. #1918

Closed
JonPaz opened this issue Jan 15, 2017 · 0 comments
Labels
Milestone

Comments

@JonPaz
Copy link

JonPaz commented Jan 15, 2017

This feature idea has come from working with the NLog.Targets.Syslog target and an issue that I raised in that project (luigiberrettini/NLog.Targets.Syslog#56)

When making calls to the static InternalLogger, it is currently common to check the enabled log level before invoking the logger - particually when the information to be logged is the result of a potentially intensive operation such an ToString(), string concatination etc.

It would be useful, and provide safer / cleaner code, for the InternalLogger class to have additional methods that allow the client to provide a function that will only get invoked when the relevent log level is enabled, thus allowing optimal performance.

This has been initially discussed with @304NotModified as part of the issue mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants