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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Serilog.TechTeaStudio.Wrap" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Serilog.TechTeaStudio.Wrap" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Serilog.TechTeaStudio.Wrap" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Serilog.TechTeaStudio.Wrap --version 0.1.4
                    
#r "nuget: Serilog.TechTeaStudio.Wrap, 0.1.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Serilog.TechTeaStudio.Wrap@0.1.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Serilog.TechTeaStudio.Wrap&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Serilog.TechTeaStudio.Wrap&version=0.1.4
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.4 121 1/10/2025
0.1.3 147 1/3/2025
0.1.2 128 1/3/2025
0.1.1 91 9/22/2024

Fix versions, add more user-developer-friendly ways of using this package.