Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Save MiniProfiler results into a Microsoft.Extensions.Logging logger.

License

Notifications You must be signed in to change notification settings

gowon/MiniProfilerContrib.Logging

Repository files navigation

MiniProfilerContrib.Logging

Nuget (with prereleases) Nuget build codecov

Save MiniProfiler results into a Microsoft.Extensions.Logging logger.

Installing via NuGet

To get started install the MiniProfilerContrib.Logging package:

PM> Install-Package MiniProfilerContrib.Logging

or

dotnet add package MiniProfilerContrib.Logging

Usage

The LoggerStorage can accept an ILoggerFactory or ILogger<MiniProfiler>. These can be retrieved through dependency injection or by bootstrapping a logger factory.

var loggerFactory = LoggerFactory.Create(builder =>
    builder
        .AddConsole()
        .AddDebug()
        .SetMinimumLevel(LogLevel.Trace));

var logger = loggerFactory.CreateLogger<MiniProfiler>()

Then, setup the MiniProfiler using a LoggerStorage, passing along the logger as well as the logging level the profiler output will be (default LogLevel.Debug).

MiniProfiler.Configure(new MiniProfilerOptions
{
    Storage = new LoggerStorage(logger)
});

And you can continue to use MiniProfiler as usual.

See the MiniProfiler documentation and the samples folder for working examples.

License

MIT

About

Save MiniProfiler results into a Microsoft.Extensions.Logging logger.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages