1 | <?php |
||
14 | abstract class Debug |
||
15 | { |
||
16 | /** |
||
17 | * Start counting time for an event |
||
18 | * @param string $event The event's name |
||
19 | * @return void |
||
20 | */ |
||
21 | 38 | public static function startStopwatch($event) |
|
22 | { |
||
23 | 38 | if (!\Service::getContainer()) { |
|
24 | return; |
||
25 | } |
||
26 | |||
27 | 38 | $stopwatch = \Service::getContainer()->get('debug.stopwatch', null); |
|
28 | |||
29 | 38 | if ($stopwatch) { |
|
30 | 38 | $stopwatch->start($event); |
|
31 | 38 | } |
|
32 | 38 | } |
|
33 | |||
34 | /** |
||
35 | * Stop counting time for an event and get its duration |
||
36 | * @param string $event The event's name |
||
37 | * @return int The time in milliseconds |
||
38 | */ |
||
39 | 38 | public static function finishStopwatch($event) |
|
57 | |||
58 | /** |
||
59 | * Log a debug message |
||
60 | * @param string $message The message to return |
||
61 | * @param array $context Any additional information to show |
||
62 | * @param string $channel The channel to store the log into |
||
63 | * @return void |
||
64 | */ |
||
65 | 38 | public static function log($message, array $context = array(), $channel = 'app') |
|
79 | |||
80 | /** |
||
81 | * Log a cache fetch in the data collector |
||
82 | * @param string $type The type of the fetched model |
||
83 | * @param int $id The ID of the fetched model |
||
84 | */ |
||
85 | 38 | public static function logCacheFetch($type, $id) |
|
94 | } |
||
95 |