feat(Online): 移除 TaskLogHub 记录到访问日志中

This commit is contained in:
Argo Zhang 2019-09-12 22:10:42 +08:00
parent 2f7265667a
commit 789685a2ba
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 13 additions and 1 deletions

View File

@ -111,7 +111,7 @@ namespace Bootstrap.Admin
app.UseStaticFiles();
app.UseBootstrapAdminAuthentication(RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseBootstrapHealthChecks();
app.UseOnlineUsers(callback: TraceHelper.Save);
app.UseOnlineUsers(TraceHelper.Filter, TraceHelper.Save);
app.UseCacheManager();
app.UseSignalR(routes =>
{

View File

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Http;
using PetaPoco;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.DataAccess
{
@ -38,6 +39,17 @@ namespace Bootstrap.DataAccess
}
}
/// <summary>
/// 进入在线跟踪的地址过滤方法
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public static bool Filter(HttpContext context)
{
var url = context.Request.Path;
return !new string[] { "/api", "/NotiHub", "/TaskLogHub", "/swagger" }.Any(r => url.StartsWithSegments(r, StringComparison.OrdinalIgnoreCase));
}
/// <summary>
/// 获得指定IP历史访问记录
/// </summary>