You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
954 B
C#

using Admin.Core.Common;
using log4net;
using Microsoft.AspNetCore.Builder;
using System;
namespace Admin.Core.Extensions
{
/// <summary>
/// MiniProfiler性能分析
/// </summary>
public static class MiniProfilerMildd
{
private static readonly ILog log = LogManager.GetLogger(typeof(MiniProfilerMildd));
public static void UseMiniProfilerMildd(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;
}
}
}
}