This commit is contained in:
cjd
2025-11-04 21:09:16 +08:00
parent 8260e293c7
commit bb90a020dc
592 changed files with 61749 additions and 27 deletions

View File

@@ -0,0 +1,33 @@
using DouyinApi.Common;
using Microsoft.AspNetCore.Builder;
using System;
using Serilog;
namespace DouyinApi.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;
}
}
}
}