You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
778 B
31 lines
778 B
using Microsoft.AspNetCore.Builder;
|
|
using Serilog;
|
|
using Tiobon.Core.Common;
|
|
|
|
namespace Tiobon.Core.Extensions.Middlewares;
|
|
|
|
/// <summary>
|
|
/// MiniProfiler性能分析
|
|
/// </summary>
|
|
public static class MiniProfilerMiddleware
|
|
{
|
|
public static void UseMiniProfilerMiddleware(this IApplicationBuilder app)
|
|
{
|
|
if (app == null) throw new ArgumentNullException(nameof(app));
|
|
|
|
try
|
|
{
|
|
if (AppSettings.app("Startup", "MiniProfiler", "Enabled").ObjToBool())
|
|
{
|
|
// 性能分析
|
|
app.UseMiniProfiler();
|
|
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error($"An error was reported when starting the MiniProfilerMildd.\n{e.Message}");
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
|