2.0.0 File Share Examples
The follwoing example is available (appsettings.json); the rest of the code examples below are the same regardless of the way of working you opt for.
Required NuGet packages
- Microsoft.Extensions.Configuration.Json
- Nodinite.Serilog.FileSink
- Serilog.Settings.Configuration
Dependencies in Project (.csproj)
The version should be properly updated when you update the NuGet packages. All versions below are only an example. Make sure to timely update to the latest.
Startup file (Program.cs)
Log (Function.cs)
Inject the Logger inside the constructor instead on the method level.
appsettings.json
New 2.0.25
The FileExtension setting is new with version 2.0.25. The Default is .txt
. The Nodinite Serilog sinks produces a JSON and to preserve backwards compatibility, you must override the default if you want the output to be {guid}.json
.
The FileExtension setting was introduced in version 2.0.25. The default is .txt
. The Nodinite Serilog sinks output JSON, and to maintain backward compatibility, you must override the default if you want the output format to be {guid}.json
instead of {guid}.txt
.