This repository contains the sources for the client-side components of the LogFlake product suite for applications logs and performance collection for .NET applications.
| NuGet Package Name | Version | Downloads |
|---|---|---|
| LogFlake.Client.NetStandard |
- Retrieve your application-key from Application Settings in LogFlake UI;
- Add in your
secrets.jsonfile the following section:
"LogFlake": {
"AppId": "application-key",
"Endpoint": "https://logflake-instance-here" // optional, if missing uses production endpoint
}- Implement and register as Sigleton the interface
IVersionService; - In your
Program.csfiles, register the LogFlake-related services:
// configuration is an instance of IConfiguration
services.AddLogFlake(configuration);- In your services, simply require
ILogFlakeServiceas a dependency;
public class SimpleService : ISimpleService
{
private readonly ILogFlakeService _logFlakeService;
public SimpleService(ILogFlakeService logFlakeService)
{
_logFlakeService = logFlakeService ?? throw new ArgumentNullException(nameof(logFlakeService));
}
}- Use it in your service
// SimpleService.cs
public void MyMethod()
{
try
{
doSomething();
_logFlakeService.WriteLog(LogLevels.INFO, "Hello World", "correlation");
}
catch (MeaningfulException ex)
{
_logFlakeService.WriteException(ex, "correlation");
}
}