SmartApp.lk.Mongo.Logger Log is a lightweight logging library for .NET applications, enabling seamless logging of application events, errors, and performance metrics directly to a MongoDB database. This package helps you centralize your logs, making them easily accessible for monitoring, analysis, and troubleshooting. Key Features: - Easy integration with .NET applications - Support for various log levels (Info, Debug, Error, etc.) - Automatic handling of log rotations and archival - Flexible configuration options - Asynchronous logging for minimal performance impact - Structured logging with custom fields - Compatibility with .NET Core 8 and .NET Framework Installation: 1. Install the package via NuGet: `dotnet add package SmartApp.lk.Mongo.Logger` 2. Configure your MongoDB connection string and logging settings in the application configuration file. Usage: Program.cs var configuration = builder.Configuration builder.Services.SmartApplkMongoLogerServices<SMARTAppLOGER>( new Option { IsDeleteCollection = true, KeepLastCollection = 5, CollectionCreateWithin = CollectionCreateWithin.BYHOURS, connectionString = configuration.GetConnectionString("MongoConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."), databaseName = configuration.GetConnectionString("MongoDatabase") ?? throw new InvalidOperationException("Databasse string 'DefaultConnection' not found."), }); await this.smartMongoLoger.InsertAsync(new SmartLogger<SMARTAppLOGER> { LogModel = new SMARTAppLOGER { CreatedDate = DateTime.Now, ErrorMasg = "error Description" } },DateTime.UtcNow);
License
—
Deps
3
Install Size
—
Vulns
✓ 0
Published
Jun 24, 2024
$ dotnet add package SmartApp.lk.Mongo.LoggerNo README available.