File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,37 @@ public function process(Request $request, callable $next): Response
3333 {
3434 static $ initialized_db , $ initialized_think_orm ;
3535
36+ $ conf =config ('plugin.webman.log.app ' );
37+
38+ //跳过配置的模块
39+ if (!empty ($ conf ['dontReport ' ]['app ' ]) && is_array ($ conf ['dontReport ' ]['app ' ]) && in_array ($ request ->app ,$ conf ['dontReport ' ]['app ' ],true )){
40+ return $ next ($ request );
41+ }
42+
43+ //跳过配置的path
44+ if (!empty ($ conf ['dontReport ' ]['path ' ]) && is_array ($ conf ['dontReport ' ]['path ' ])){
45+ $ requestPath =$ request ->path ();
46+ foreach ($ conf ['dontReport ' ]['path ' ] as $ _path ){
47+ if (strpos ($ requestPath ,$ _path )===0 ){
48+ return $ next ($ request );
49+ }
50+ }
51+ }
52+
53+ //跳过配置的控制器日志记录
54+ if (!empty ($ conf ['dontReport ' ]['controller ' ]) && is_array ($ conf ['dontReport ' ]['controller ' ]) && in_array ($ request ->controller ,$ conf ['dontReport ' ]['controller ' ],true )){
55+ return $ next ($ request );
56+ }
57+
58+ //跳过配置的方法
59+ if (!empty ($ conf ['dontReport ' ]['action ' ]) && is_array ($ conf ['dontReport ' ]['action ' ])){
60+ foreach ($ conf ['dontReport ' ]['action ' ] as $ _action ){
61+ if ($ _action [0 ]===$ request ->controller && $ _action [1 ]===$ request ->action ){
62+ return $ next ($ request );
63+ }
64+ }
65+ }
66+
3667 // 请求开始时间
3768 $ start_time = microtime (true );
3869
Original file line number Diff line number Diff line change 88 'dontReport ' => [
99 support \exception \BusinessException::class
1010 ]
11+ ],
12+ 'dontReport ' => [
13+ 'app ' => [
14+ 'test ' ,
15+ ],
16+ 'controller ' => [
17+ Test::class,
18+ ],
19+ 'action ' => [
20+ [Test::class, 'index ' ],
21+ ],
22+ 'path ' => [
23+ '/test ' ,
24+ '/test/echo '
25+ ]
1126 ]
1227];
You can’t perform that action at this time.
0 commit comments