1 | <?php |
||
8 | class LoggerCallback |
||
9 | { |
||
10 | /** |
||
11 | * @var \Closure |
||
12 | */ |
||
13 | private $buildCallback; |
||
14 | |||
15 | /** |
||
16 | * @var \Closure |
||
17 | */ |
||
18 | private $runStdoutCallback; |
||
19 | |||
20 | /** |
||
21 | * @var \Closure |
||
22 | */ |
||
23 | private $runStderrCallback; |
||
24 | |||
25 | /** |
||
26 | * @var LoggerInterface |
||
27 | */ |
||
28 | private $logger; |
||
29 | |||
30 | public function __construct(LoggerInterface $logger) |
||
41 | |||
42 | /** |
||
43 | * Get the build log callback when building / pulling an image |
||
44 | * |
||
45 | * @return callable |
||
46 | */ |
||
47 | public function getBuildCallback() |
||
51 | |||
52 | /** |
||
53 | * Get the run stdout callback for docker |
||
54 | * |
||
55 | * @return callable |
||
56 | */ |
||
57 | public function getRunStdoutCallback() |
||
61 | |||
62 | /** |
||
63 | * Get the run stderr callback for docker |
||
64 | * |
||
65 | * @return callable |
||
66 | */ |
||
67 | public function getRunStderrCallback() |
||
71 | |||
72 | /** |
||
73 | * Clear static log buffer |
||
74 | */ |
||
75 | public function clearStatic() |
||
79 | |||
80 | /** |
||
81 | * The build callback when creating a image, useful to see what happens during building |
||
82 | * |
||
83 | * @param BuildInfo $output An encoded json string from docker daemon |
||
84 | */ |
||
85 | private function buildCallback(BuildInfo $output) |
||
116 | |||
117 | /** |
||
118 | * Run callback to catch stdout logs of test running |
||
119 | * |
||
120 | * @param string $output Output from run (stdout) |
||
121 | */ |
||
122 | private function runStdoutCallback($output) |
||
126 | |||
127 | /** |
||
128 | * Run callback to catch stderr logs of test running |
||
129 | * |
||
130 | * @param string $output Output from run (stderr) |
||
131 | */ |
||
132 | private function runStderrCallback($output) |
||
136 | } |
||
137 |