Egov.Integrations.MLog
10.0.1
Prefix Reserved
dotnet add package Egov.Integrations.MLog --version 10.0.1
NuGet\Install-Package Egov.Integrations.MLog -Version 10.0.1
<PackageReference Include="Egov.Integrations.MLog" Version="10.0.1" />
<PackageVersion Include="Egov.Integrations.MLog" Version="10.0.1" />
<PackageReference Include="Egov.Integrations.MLog" />
paket add Egov.Integrations.MLog --version 10.0.1
#r "nuget: Egov.Integrations.MLog, 10.0.1"
#:package Egov.Integrations.MLog@10.0.1
#addin nuget:?package=Egov.Integrations.MLog&version=10.0.1
#tool nuget:?package=Egov.Integrations.MLog&version=10.0.1
Egov.Integrations.MLog
A production-ready C# library for integrating with MLog services. This library provides a clean and easy-to-use client to register and query events using secure certificate-based authentication, designed for modern cloud-native and microservices architectures.
Table of Contents
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Testing
- Contributing
- Code of Conduct
- AI Assistance
- License
Features
- Simple Event Registration: Register single events or batches of events with a rich metadata model.
- Advanced Querying: Search for events by UID or time range with customizable filtering.
- Secure Authentication: Built-in support for mutual TLS (mTLS) using certificate-based authentication.
- Dependency Injection: Seamless integration with standard .NET dependency injection (
IServiceCollection). - Asynchronous API: Native support for
async/awaitpatterns for non-blocking I/O. - Modern .NET: Built for .NET 10+ leveraging the latest runtime improvements.
Prerequisites
- .NET 10.0 or later
- Valid MLog client certificate for authentication
Installation
Install the package via NuGet:
dotnet add package Egov.Integrations.MLog
Configuration
The library uses MLogClientOptions for configuration. You can configure it via appsettings.json or in code.
appsettings.json
{
"MLog": {
"BaseAddress": "https://mlog.staging.egov.md:8443"
},
"Certificate": {
"Path": "path/to/your/certificate.pfx",
"Password": "your_password"
}
}
Dependency Injection Setup
Register the MLog client in your Program.cs:
using Egov.Integrations.MLog;
var builder = WebApplication.CreateBuilder(args);
// Add certificate support (from Age.Extensions.Configuration)
builder.Services.AddSystemCertificate(builder.Configuration.GetSection("Certificate"));
// Add MLog Client
builder.Services.AddMLogClient(builder.Configuration.GetSection("MLog"));
var app = builder.Build();
Usage
Registering an Event
Use the IMLogClient to register events fluently:
using Egov.Integrations.MLog;
using Egov.Integrations.MLog.Models;
public class MyService(IMLogClient mlogClient)
{
public async Task LogSomethingAsync()
{
var mlogEvent = new MLogEvent("my.app.event")
{
EventID = Guid.NewGuid().ToString("D"),
EventCorrelation = "corr-123",
EventMessage = "Something important happened",
EventLevel = "INFO",
EventTime = DateTime.UtcNow,
User = "user-id-789"
};
string eventId = await mlogClient.RegisterEventAsync(mlogEvent);
Console.WriteLine($"Event registered with ID: {eventId}");
}
}
Querying Events
Query events based on time ranges and legal context:
public async Task SearchEventsAsync(IMLogClient mlogClient)
{
var from = DateTime.UtcNow.AddDays(-1);
var to = DateTime.UtcNow;
var legalBasis = "Law 123/2023, Art 5";
string results = await mlogClient.QueryEventsAsync(from, to, legalBasis);
Console.WriteLine(results);
}
Testing
The solution includes a comprehensive test suite using xUnit.
Running the tests
dotnet test src/Egov.Integrations.MLog.sln
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to get started.
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
AI Assistance
This repository contains an AGENTS.md file with instructions and context for AI coding agents to assist in development, ensuring consistency in code style and project structure.
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Egov.Extensions.Configuration (>= 10.0.4)
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 |
|---|---|---|
| 10.0.1 | 157 | 4/14/2026 |