1 | <?php |
||
18 | class NatsLogger |
||
19 | { |
||
20 | protected $logger; |
||
21 | protected $nbCommands = 0; |
||
22 | protected $commands = array(); |
||
23 | protected $start; |
||
24 | |||
25 | /** |
||
26 | * Constructor. |
||
27 | * |
||
28 | * @param LoggerInterface $logger A LoggerInterface instance |
||
29 | * |
||
30 | * @throws \InvalidArgumentException |
||
31 | */ |
||
32 | public function __construct($logger = null) |
||
36 | |||
37 | /** |
||
38 | * Logs a command |
||
39 | * |
||
40 | * @param string $command Nats command |
||
41 | * @param float $duration Duration in milliseconds |
||
42 | * @param string $connection Connection alias |
||
43 | * @param bool|string $error Error message or false if command was successful |
||
44 | */ |
||
45 | public function logCommand($command, $duration, $connection, $error = false) |
||
64 | |||
65 | /** |
||
66 | * Returns the number of logged commands. |
||
67 | * |
||
68 | * @return integer |
||
69 | */ |
||
70 | public function getNbCommands() |
||
74 | |||
75 | /** |
||
76 | * Returns an array of the logged commands. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | public function getCommands() |
||
84 | } |