1 | <?php |
||
5 | class Logger |
||
6 | { |
||
7 | /** |
||
8 | * Flag to determine whether a debug log should be generated by the calculation engine |
||
9 | * If true, then a debug log will be generated |
||
10 | * If false, then a debug log will not be generated. |
||
11 | * |
||
12 | * @var bool |
||
13 | */ |
||
14 | private $writeDebugLog = false; |
||
15 | |||
16 | /** |
||
17 | * Flag to determine whether a debug log should be echoed by the calculation engine |
||
18 | * If true, then a debug log will be echoed |
||
19 | * If false, then a debug log will not be echoed |
||
20 | * A debug log can only be echoed if it is generated. |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | private $echoDebugLog = false; |
||
25 | |||
26 | /** |
||
27 | * The debug log generated by the calculation engine. |
||
28 | * |
||
29 | * @var string[] |
||
30 | */ |
||
31 | private $debugLog = []; |
||
32 | |||
33 | /** |
||
34 | * The calculation engine cell reference stack. |
||
35 | * |
||
36 | * @var CyclicReferenceStack |
||
37 | */ |
||
38 | private $cellStack; |
||
39 | |||
40 | /** |
||
41 | * Instantiate a Calculation engine logger. |
||
42 | * |
||
43 | * @param CyclicReferenceStack $stack |
||
44 | */ |
||
45 | 134 | public function __construct(CyclicReferenceStack $stack) |
|
49 | |||
50 | /** |
||
51 | * Enable/Disable Calculation engine logging. |
||
52 | * |
||
53 | * @param bool $pValue |
||
54 | */ |
||
55 | 60 | public function setWriteDebugLog($pValue) |
|
59 | |||
60 | /** |
||
61 | * Return whether calculation engine logging is enabled or disabled. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 143 | public function getWriteDebugLog() |
|
69 | |||
70 | /** |
||
71 | * Enable/Disable echoing of debug log information. |
||
72 | * |
||
73 | * @param bool $pValue |
||
74 | */ |
||
75 | public function setEchoDebugLog($pValue) |
||
79 | |||
80 | /** |
||
81 | * Return whether echoing of debug log information is enabled or disabled. |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function getEchoDebugLog() |
||
89 | |||
90 | /** |
||
91 | * Write an entry to the calculation engine debug log. |
||
92 | */ |
||
93 | 116 | public function writeDebugLog(...$args) |
|
110 | |||
111 | /** |
||
112 | * Clear the calculation engine debug log. |
||
113 | */ |
||
114 | 47 | public function clearLog() |
|
118 | |||
119 | /** |
||
120 | * Return the calculation engine debug log. |
||
121 | * |
||
122 | * @return string[] |
||
123 | */ |
||
124 | public function getLog() |
||
128 | } |
||
129 |