| | |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.LogHelper; |
| | | |
| | | namespace WIDESEA_Core.AOP |
| | | { |
| | | /// <summary> |
| | | /// æ¦æªå¨BlogLogAOP ç»§æ¿IInterceptoræ¥å£ |
| | | /// æ¦æªå¨LogAOP ç»§æ¿IInterceptoræ¥å£ |
| | | /// </summary> |
| | | public class LogAOP : IInterceptor |
| | | { |
| | |
| | | try |
| | | { |
| | | MiniProfiler.Current.Step($"æ§è¡{invocation.InvocationTarget}.{invocation.Method.Name}()æ¹æ³ -> "); |
| | | |
| | | //MethodParamsValidateAttribute? paramsValidateAttribute = invocation.Method.GetCustomAttribute<MethodParamsValidateAttribute>(); |
| | | //if (paramsValidateAttribute != null) |
| | | //{ |
| | | // foreach (var item in invocation.Arguments) |
| | | // { |
| | | |
| | | // } |
| | | //} |
| | | //å¨è¢«æ¦æªçæ¹æ³æ§è¡å®æ¯å ç»§ç»æ§è¡å½åæ¹æ³ï¼æ³¨ææ¯è¢«æ¦æªçæ¯å¼æ¥ç |
| | | invocation.Proceed(); |
| | | |
| | | // 弿¥è·åå¼å¸¸ï¼å
æ§è¡ |
| | | if (IsAsyncMethod(invocation.Method)) |
| | | { |
| | |
| | | apiLogAopInfo.ResponseJsonData = jsonResult; |
| | | Parallel.For(0, 1, e => |
| | | { |
| | | LogLock.OutLogAOP("AOPLog", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) }); |
| | | LogLock.OutLogAOP("å
¨å±æ¥å¿AOP", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) }); |
| | | }); |
| | | } |
| | | } |
| | |
| | | Parallel.For(0, 1, e => |
| | | { |
| | | //LogLock.OutSql2Log("AOPLog", new string[] { JsonConvert.SerializeObject(apiLogAopInfo) }); |
| | | LogLock.OutLogAOP("AOPLog", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) }); |
| | | LogLock.OutLogAOP("å
¨å±æ¥å¿AOP", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) }); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | // å¼å¸¸æ¥å¿éæè¯¦ç»çå æ ä¿¡æ¯ |
| | | Parallel.For(0, 1, e => |
| | | { |
| | | LogLock.OutLogAOP("AOPLogEx", new string[] { apiLogAopExInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopExInfo) }); |
| | | LogLock.OutLogAOP("å
¨å±å¼å¸¸é误æ¥å¿AOP", new string[] { apiLogAopExInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopExInfo) }); |
| | | }); |
| | | } |
| | | } |