.NET Core 3.0 releases new compelling features.
Two of these new features are Channels and the new API System.Text.Json, which are heavily motivated by performance.
These features allow us to achieve better performance when we are building our applications.
To try out these features, I've created a logging provider component using .NET Core 3.0. The project is a PoC.
Architecture Diagram
The architecture diagram of the component looks like
The idea is simple; the app writes logs into a shared channel synchronously. Then, two hosted services are listening in the background and pulling messages from the channel to execute the bulk insert into a SQL Server database.
Limitations
It writes log records into a SQL Server Database using batch sizes or when the timer reaches the end. You can use this project to getting started to write log records wherever you want.
To dig into the code
mpetrinidev / yadl
Yet another dotnet logger
Yadl stands for Yet another dotnet logger
The implementation is built on top of the dotnet logger using Channels and System.Text.Json. These features are new in .NET Core 3.0
Architecture
Here's the architecture diagram of the component.
Set up the database
Execute ./build.sh
or ./build.ps1
depending on your operating system to create the SQL server and begin to use the sample.
These files execute the docker container to download the SQL server image and run the necessary script to create the logs table's database.
Limitations
It writes log records into a SQL Server Database using batch sizes or when the timer reaches the end. You can use this project to getting started to write log records wherever you want.
Closing Thoughts
Channels and System.Text.Json are new compelling features to come into the latest version of .NET Core.
On the other, creating a PoC helps me to try out new features in a programming language and make better decisions in the software that I am building.
We are looking forward to .NET 5 π€©
Top comments (0)