Our great sponsors
-
InterpolatedLogging
Wrappers around ILoggers (Microsoft Extensions Logging, Serilog, NLog, etc) to accept Interpolated Strings
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
EntityFrameworkCore.RawQueryBuilder
Entity Framework Core Query Builder (allows to dynamically add conditions) using Raw SQL statements and string interpolation
You should take a look at the improved interpolated string builder proposal I'm working on for C# 10: https://github.com/dotnet/csharplang/blob/main/proposals/improved-interpolated-strings.md. One of the current problems with interpolated strings for logging is unwanted calls to string.Format and computation of the holes when the current log level isn't enabled, and this proposal will allow you define a builder type that interpolated string literals will be convertible to. This builder will be able to take in context information, and prevent unnecessary formatting costs by simply returning false during builder creation.
LOL. Just a bored developer who saw an opportunity. :-) When I posted a few days ago about DapperQueryBuilder someone suggested that this same FormattableString-hacking could be used for Logging libraries. Since the major parts of processing FormattableString are identical (same regex, same loops, etc) and since I was a little bored this weekend I decided to try out this idea :-)
Take a look at Compile-time source generation for structured log messages by maryamariyan · Pull Request #195 · dotnet/designs (github.com) as well
Sorry, I've replied the wrong message. I was referring to this https://github.com/geeknoid/LoggingGenerator which was mentioned below.
@Willinton06 - Ok, ok. You busted me out - I love string interpolation! New project: https://github.com/Drizin/EntityFrameworkCore.RawQueryBuilder
Related posts
- Interpolated String Builder: like a StringBuilder but for Interpolated Strings
- Interceptors (new C# metaprogramming feature) to fuel DapperAOT development
- Dapper Simple SQL Builder (A simple SQL builder for Dapper using string interpolation)
- DapperQueryBuilder using string interpolation
- Dapper Query Builder using String Interpolation - making Dapper easier, and on my way to reach 250 stars :-)