Logging Source Code Generators #14
Replies: 2 comments 9 replies
-
|
Thanks, For this article, |
Beta Was this translation helpful? Give feedback.
-
|
I think your benchmark compares very different things. If you modify your NoLog as: Note that this version still doesn't do the actual logging, but it does the formatting of the messge. With this version, all the three functions perform the formatting, and here is the new/correct benchmark:
The advantage of the compile time generated functions stands only in the fact they check the IsEnabled before the actual formatting and logging, so, if the current logging level is not allowed, the formatting and the loggin is avoided. Now there are other ways of implementing logging that makes the function LogCreateUserBad even faster and simplier than the compile time generated functions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Logging Source Code Generators
Since .NET6 we have the possibility to define an easy way of logging common statements:
Meet Compile-time logging source generators. This article will show why we have them and how to use them. Of course a smaller benchmark will also follow.
https://steven-giesel.com/blogPost/48697958-4aee-474a-8920-e266d1d7b8fa
Beta Was this translation helpful? Give feedback.
All reactions