Serilog.TechTeaStudio.Wrap
0.1.4
dotnet add package Serilog.TechTeaStudio.Wrap --version 0.1.4
NuGet\Install-Package Serilog.TechTeaStudio.Wrap -Version 0.1.4
<PackageReference Include="Serilog.TechTeaStudio.Wrap" Version="0.1.4" />
<PackageVersion Include="Serilog.TechTeaStudio.Wrap" Version="0.1.4" />
<PackageReference Include="Serilog.TechTeaStudio.Wrap" />
paket add Serilog.TechTeaStudio.Wrap --version 0.1.4
#r "nuget: Serilog.TechTeaStudio.Wrap, 0.1.4"
#:package Serilog.TechTeaStudio.Wrap@0.1.4
#addin nuget:?package=Serilog.TechTeaStudio.Wrap&version=0.1.4
#tool nuget:?package=Serilog.TechTeaStudio.Wrap&version=0.1.4
Serilog.TechTeaStudio.Wrap
A flexible and easy-to-use logging library for .NET applications using Serilog, providing smooth integration and configuration through Dependency Injection. It allows for quick setup with various log levels, rolling intervals, and output templates, making logging in your .NET apps a breeze. 🚀
Features 🌟
- Simple Configuration: Easily set up logging with configurable log levels, output templates, and log file settings.
- Dependency Injection: Integrates seamlessly into .NET applications using Dependency Injection, providing a clean and scalable approach.
- Log File Rolling: Supports rolling log files, which helps in managing large log files by creating a new file at specified intervals (e.g., daily).
- Customizable Output Template: Modify the format of your log messages to suit your needs.
Installation 🛠️
To install the Serilog.TechTeaStudio.Wrap
package, run the following command in your project directory:
dotnet add package Serilog.TechTeaStudio.Wrap --version 0.1.4
Alternatively, you can add it via the NuGet package manager.
Usage 📄
Here's an example of how to set up and use the logger with custom options:
// Example with configuration using options
var serviceProviderWithOptions = new ServiceCollection()
.AddLogger(options =>
{
// Set the log directory
options.LogDirectory = "logs"; // Logs will be saved in the "logs" directory
// Define the log event levels
options.LogEventLevels = new[]
{
LogEventLevel.Information, // Log informational messages
LogEventLevel.Warning, // Log warnings
LogEventLevel.Error // Log errors
};
// Set the rolling interval for log files (e.g., daily)
options.RollingInterval = RollingInterval.Day;
// Define the output template for log messages
options.OutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message:lj} {NewLine}{Exception}";
})
.BuildServiceProvider();
// Retrieve the logger with the configured settings
var loggerWithOptions = serviceProviderWithOptions.GetRequiredService<Logger>();
// Logging events using the configured logger
await loggerWithOptions.LogEventAsync(LogEventLevel.Information, "This is an information message.");
loggerWithOptions.LogEvent(LogEventLevel.Warning, "This is a warning message.");
Third-Party Licenses 📜
This project includes Serilog, which is licensed under the Apache License, Version 2.0. See the LICENSE file for the full text of the Apache License 2.0.
Dependencies 🔗
- Microsoft.Extensions.DependencyInjection: Version 9.0.0
- Serilog: Version 4.2.0
- Serilog.Sinks.File: Version 6.0.0 (for .NET 8.0) / Version 6.0.2 (for .NET 9.0)
License 📚
This package is licensed under the Apache License, Version 2.0. Please refer to the LICENSE file for the full text.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Serilog (>= 4.2.0)
- Serilog.Sinks.File (>= 6.0.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Serilog (>= 4.2.0)
- Serilog.Sinks.File (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix versions, add more user-developer-friendly ways of using this package.