-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathQueryLogger.php
More file actions
41 lines (33 loc) · 1.13 KB
/
QueryLogger.php
File metadata and controls
41 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace WP_CLI\Profile;
/**
* Logger for tracking individual database queries.
*/
class QueryLogger {
/** @var string The SQL query string. */
public $query;
/** @var float The time taken to execute the query, in seconds. */
public $time;
/** @var string The caller that initiated the query. */
public $caller;
/** @var string|null The hook associated with the query, if any. */
public $hook;
/** @var string|null The callback associated with the query, if any. */
public $callback;
/**
* QueryLogger constructor.
*
* @param string $query The SQL query string.
* @param float $time The time taken to execute the query, in seconds.
* @param string $caller The caller that initiated the query.
* @param string|null $hook Optional. The hook associated with the query.
* @param string|null $callback Optional. The callback associated with the query.
*/
public function __construct( $query, $time, $caller, $hook = null, $callback = null ) {
$this->query = $query;
$this->time = $time;
$this->caller = $caller;
$this->hook = $hook;
$this->callback = $callback;
}
}