Skip to content

Commit ff9e9f7

Browse files
committed
Added lhr_log_data hook to control whether rows get added
1 parent 6f07678 commit ff9e9f7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.svn/
2+

log-http-requests.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,18 @@ function capture_request( $response, $context, $transport, $args, $url ) {
133133
return;
134134
}
135135

136-
$wpdb->insert( $wpdb->prefix . 'lhr_log', array(
136+
// False to ignore current row
137+
$log_data = apply_filters( 'lhr_log_data', [
137138
'url' => $url,
138139
'request_args' => json_encode( $args ),
139140
'response' => json_encode( $response ),
140141
'runtime' => ( microtime( true ) - $this->start_time ),
141142
'date_added' => current_time( 'mysql' )
142-
) );
143+
]);
144+
145+
if ( false !== $log_data ) {
146+
$wpdb->insert( $wpdb->prefix . 'lhr_log', $log_data );
147+
}
143148
}
144149

145150

0 commit comments

Comments
 (0)