Acontplus.Common.Logging 0.0.4

dotnet add package Acontplus.Common.Logging --version 0.0.4                
NuGet\Install-Package Acontplus.Common.Logging -Version 0.0.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="Acontplus.Common.Logging" Version="0.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Acontplus.Common.Logging --version 0.0.4                
#r "nuget: Acontplus.Common.Logging, 0.0.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.
// Install Acontplus.Common.Logging as a Cake Addin
#addin nuget:?package=Acontplus.Common.Logging&version=0.0.4

// Install Acontplus.Common.Logging as a Cake Tool
#tool nuget:?package=Acontplus.Common.Logging&version=0.0.4                

Acontplus.Common.Logging

Description

Acontplus.Common.Logging is a library that provides an advanced logging system for .NET applications. It allows storing logs in local files, Amazon S3, or a database, depending on the configuration defined in appsettings.json.

Installation

To install the library, run the following command in the NuGet Package Manager Console:

Install-Package Acontplus.Common.Logging
dotnet add package Acontplus.Common.Logging

Configuration

To enable and customize the logging system, edit the appsettings.json file and add the following section:

"AdvancedLogging": {
    "EnableLocalFile": true,
    "Shared": false,
    "Buffered": true,
    "LocalFilePath": "logs/log-.log",
    "RollingInterval": "Day",
    "RetainedFileCountLimit": 7,
    "FileSizeLimitBytes": 10485760, // 10MB in bytes
    "EnableS3Logging": false,
    "S3BucketName": "my-application-logs",
    "S3AccessKey": "your-access-key",
    "S3SecretKey": "your-secret-key",
    "EnableDatabaseLogging": false,
    "DatabaseConnectionString": "Server=...",
    "MinimumLogLevel": "Information"
}

Configuration Options

  • EnableLocalFile (bool): Enables or disables storing logs in local files.
  • Shared (bool): Enables or disables shared log files.
  • Buffered (bool): Enables or disables buffered logging.
  • LocalFilePath (string): Path to the log file. It can include {Date} to generate a file per day.
  • RollingInterval (string): Interval to roll log files. Possible values: Year, Month, Day, Hour, Minute.
  • RetainedFileCountLimit (int): Number of log files to keep.
  • FileSizeLimitBytes (int): Maximum size of the log file in bytes.
  • EnableS3Logging (bool): Enables or disables storing logs in Amazon S3.
  • S3BucketName (string): Name of the S3 bucket where logs will be stored.
  • S3AccessKey (string): AWS access key for the S3 bucket.
  • S3SecretKey (string): AWS secret key for the S3 bucket.
  • EnableDatabaseLogging (bool): Enables or disables storing logs in a database.
  • DatabaseConnectionString (string): Connection string to the database where logs will be stored.
  • MinimumLogLevel (string): Minimum log level to be recorded. Possible values: Trace, Debug, Information, Warning, Error, Critical.

Usage

Once configured, the logging system will activate according to the settings defined in appsettings.json. It is recommended to check file access permissions, S3 configuration, and the database connection string to ensure proper functionality.

Inject in your services in program:

    builder.Services.AddAdvancedLogging(builder.Configuration);

Requirements

  • .NET 6 or higher
  • Proper write permissions if EnableLocalFile is enabled.
  • AWS account with S3 permissions if EnableS3Logging is enabled.
  • Accessible database if EnableDatabaseLogging is enabled.

Contributions

Contributions to improve this library are welcome. To report bugs or suggestions, open an issue in the official repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

If you have any questions or need support, please feel free to contact us.

  • Author: Ivan Paz
  • Company: Acontplus S.A.S.
  • Email: ifer343@gmail.com

Product Compatible and additional computed target framework versions.
.NET 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. 
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.0.4 0 2/6/2025
0.0.3 0 2/6/2025
0.0.2 37 2/5/2025
0.0.1 29 2/5/2025