Skip to content

TipiCode/Orion-Nuget

Repository files navigation

Tipicode.Orion.Logger

An ASP.NET Core ILogger provider that forwards log entries to the Orion centralized logging API. Drop-in replacement for the default logger — authenticated via a per-app API key.

Installation

dotnet add package Tipicode.Orion.Logger

Quick Start

Wire the provider into your app's logging pipeline in Program.cs:

builder.Logging.AddOrionLogging(options =>
{
    options.BaseUrl      = "https://your-orion-api.com";
    options.ApiKey       = "log-api-key-from-GET-api-apps-id";
    options.Environment  = "production";        // optional, default: "production"
    options.MinimumLevel = LogLevel.Warning;    // optional, default: Information
});

Then inject and use ILogger<T> as normal — no other changes required.

public class MyService
{
    private readonly ILogger<MyService> _logger;

    public MyService(ILogger<MyService> logger) => _logger = logger;

    public void DoWork()
    {
        _logger.LogInformation("Work started.");
        _logger.LogError("Something went wrong.");
    }
}

Configuration Options

Property Type Default Description
BaseUrl string (required) Base URL of your Orion API, e.g. https://orion.example.com
ApiKey string (required) Log API key from GET /api/apps/{id}logApiKey
Environment string "production" Environment tag attached to every log entry
MinimumLevel LogLevel Information Minimum log level to forward
ChannelCapacity int 4096 Max queued entries before oldest are dropped

How It Works

Log entries are written to a bounded in-memory channel and flushed asynchronously via a background worker — keeping your request path non-blocking. If the channel is full, the oldest unprocessed entry is dropped to protect host memory. On disposal the provider drains the queue (up to 5 seconds) before releasing resources.

License

MIT

About

Nuget para comunicarse con la plataforma de gestión de errores y logs Orion.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages