@@ -124,7 +124,7 @@ impl AppGuardImpl {
124
124
} )
125
125
}
126
126
127
- fn config_log_requests ( & self ) -> Result < bool , Error > {
127
+ fn is_log_request ( & self ) -> Result < bool , Error > {
128
128
Ok ( self
129
129
. ctx
130
130
. config_pair
@@ -134,7 +134,7 @@ impl AppGuardImpl {
134
134
. log_request )
135
135
}
136
136
137
- fn config_log_responses ( & self ) -> Result < bool , Error > {
137
+ fn is_log_response ( & self ) -> Result < bool , Error > {
138
138
Ok ( self
139
139
. ctx
140
140
. config_pair
@@ -309,10 +309,10 @@ impl AppGuardImpl {
309
309
let fw_res = self . firewall_match_item ( token, req. get_ref ( ) ) . await ?;
310
310
let policy = fw_res. policy ;
311
311
312
- let id = self . entry_ids . get_next ( DbTable :: HttpRequest ) . await ?;
313
- log:: info!( "***{policy:?}*** HTTP request #{id}: {}" , req. get_ref( ) ) ;
312
+ if self . is_log_request ( ) ? {
313
+ let id = self . entry_ids . get_next ( DbTable :: HttpRequest ) . await ?;
314
+ log:: info!( "***{policy:?}*** HTTP request #{id}: {}" , req. get_ref( ) ) ;
314
315
315
- if self . config_log_requests ( ) ? {
316
316
let details = DbDetails :: new ( id, fw_res, req. get_ref ( ) . tcp_info . as_ref ( ) , None ) ;
317
317
self . tx_store
318
318
. send ( DbEntry :: HttpRequest ( ( req. get_ref ( ) . clone ( ) , details) ) )
@@ -337,10 +337,10 @@ impl AppGuardImpl {
337
337
let fw_res = self . firewall_match_item ( token, req. get_ref ( ) ) . await ?;
338
338
let policy = fw_res. policy ;
339
339
340
- let id = self . entry_ids . get_next ( DbTable :: HttpResponse ) . await ?;
341
- log:: info!( "***{policy:?}*** HTTP response #{id}: {}" , req. get_ref( ) ) ;
340
+ if self . is_log_response ( ) ? {
341
+ let id = self . entry_ids . get_next ( DbTable :: HttpResponse ) . await ?;
342
+ log:: info!( "***{policy:?}*** HTTP response #{id}: {}" , req. get_ref( ) ) ;
342
343
343
- if self . config_log_responses ( ) ? {
344
344
let tcp_id = req
345
345
. get_ref ( )
346
346
. tcp_info
@@ -367,10 +367,10 @@ impl AppGuardImpl {
367
367
let fw_res = self . firewall_match_item ( token, req. get_ref ( ) ) . await ?;
368
368
let policy = fw_res. policy ;
369
369
370
- let id = self . entry_ids . get_next ( DbTable :: SmtpRequest ) . await ?;
371
- log:: info!( "***{policy:?}*** SMTP request #{id}: {}" , req. get_ref( ) ) ;
370
+ if self . is_log_request ( ) ? {
371
+ let id = self . entry_ids . get_next ( DbTable :: SmtpRequest ) . await ?;
372
+ log:: info!( "***{policy:?}*** SMTP request #{id}: {}" , req. get_ref( ) ) ;
372
373
373
- if self . config_log_requests ( ) ? {
374
374
let details = DbDetails :: new ( id, fw_res, req. get_ref ( ) . tcp_info . as_ref ( ) , None ) ;
375
375
self . tx_store
376
376
. send ( DbEntry :: SmtpRequest ( ( req. into_inner ( ) , details) ) )
@@ -388,10 +388,10 @@ impl AppGuardImpl {
388
388
let fw_res = self . firewall_match_item ( token, req. get_ref ( ) ) . await ?;
389
389
let policy = fw_res. policy ;
390
390
391
- let id = self . entry_ids . get_next ( DbTable :: SmtpResponse ) . await ?;
392
- log:: info!( "***{policy:?}*** SMTP response #{id}: {}" , req. get_ref( ) ) ;
391
+ if self . is_log_response ( ) ? {
392
+ let id = self . entry_ids . get_next ( DbTable :: SmtpResponse ) . await ?;
393
+ log:: info!( "***{policy:?}*** SMTP response #{id}: {}" , req. get_ref( ) ) ;
393
394
394
- if self . config_log_responses ( ) ? {
395
395
let tcp_id = req
396
396
. get_ref ( )
397
397
. tcp_info
0 commit comments