HttpGlobalExceptionFilter.cs 739 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Hh.Mes.Common.log;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.Service.Logs;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Hh.Mes.Api.AOP
{
    /// <summary>
    /// 全局日志异常类
    /// </summary>
    public class HttpGlobalExceptionFilter : IExceptionFilter
    {
        public void OnException(ExceptionContext context)
        {
            var msg = context.Exception.ToString();
            Log4NetHelper.Instance.Info(msg);

            QueueInterLog.GetInstance.EnqueueInterLog(null, null, EnumLog.AOP全局错误.ToString(), msg, 0, user: "AOP", system: EnumLog.AOP全局错误.ToString());
        }
    }
}