Skip to content

CloudPhoenix/logflake-client-netstandard

Repository files navigation

LogFlake Client .NET Standard Version

This repository contains the sources for the client-side components of the LogFlake product suite for applications logs and performance collection for .NET applications.

Downloads

NuGet Package Name Version Downloads
LogFlake.Client.NetStandard NuGet Version NuGet Downloads

Usage

  1. Retrieve your application-key from Application Settings in LogFlake UI;
  2. Add in your secrets.json file the following section:
"LogFlake": {
  "AppId": "application-key",
  "Endpoint": "https://logflake-instance-here"  // optional, if missing uses production endpoint
}
  1. Implement and register as Sigleton the interface IVersionService;
  2. In your Program.cs files, register the LogFlake-related services:
// configuration is an instance of IConfiguration
services.AddLogFlake(configuration);
  1. In your services, simply require ILogFlakeService as a dependency;
public class SimpleService : ISimpleService
{
    private readonly ILogFlakeService _logFlakeService;

    public SimpleService(ILogFlakeService logFlakeService)
    {
        _logFlakeService = logFlakeService ?? throw new ArgumentNullException(nameof(logFlakeService));
    }
}
  1. 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");
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages