feat(Rollbar): 增加异常通知功能
This commit is contained in:
parent
8ce886af81
commit
22b863ff24
|
@ -20,6 +20,7 @@
|
|||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.9" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" PrivateAssets="All" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
|
||||
<PackageReference Include="Rollbar.NetCore.AspNet" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -13,8 +13,10 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.AspNetCore.Mvc.Versioning;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Rollbar.NetCore.AspNet;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -70,6 +72,10 @@ namespace Bootstrap.Admin
|
|||
services.AddSignalR().AddJsonProtocalDefault();
|
||||
services.AddSignalRExceptionFilterHandler<SignalRHub>(async (client, ex) => await SignalRManager.Send(client, ex));
|
||||
services.AddResponseCompression();
|
||||
services.AddRollbarLogger(loggerOptions =>
|
||||
{
|
||||
loggerOptions.Filter = (loggerName, loglevel) => loglevel >= LogLevel.Trace;
|
||||
});
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.Filters.Add<BootstrapAdminAuthorizeFilter>();
|
||||
|
@ -137,6 +143,7 @@ namespace Bootstrap.Admin
|
|||
app.UseOnlineUsers(callback: TraceHelper.Save);
|
||||
app.UseCacheManagerCorsHandler();
|
||||
app.UseSignalR(routes => { routes.MapHub<SignalRHub>("/NotiHub"); });
|
||||
app.UseRollbarMiddleware();
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
"FileName": "Error\\Log.log"
|
||||
}
|
||||
},
|
||||
"Rollbar": {
|
||||
"AccessToken": "2fbdc15dff334a73a5542e6e82309a35",
|
||||
"Environment": "AspNetCoreMiddlewareTest"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue