|
12 | 12 | // </copyright> |
13 | 13 | //----------------------------------------------------------------------- |
14 | 14 |
|
| 15 | +using Microsoft.PSharp.Utilities; |
| 16 | +using System; |
| 17 | + |
15 | 18 | namespace Microsoft.PSharp.IO |
16 | 19 | { |
17 | 20 | /// <summary> |
18 | 21 | /// Logger that disposes all written text. |
19 | 22 | /// </summary> |
20 | 23 | internal sealed class DisposingLogger : ILogger |
21 | 24 | { |
| 25 | + /// <summary> |
| 26 | + /// The configuration that sets the logging verbosity. |
| 27 | + /// </summary> |
| 28 | + public Configuration Configuration { get; set; } |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// The minimum logging verbosity level (should be >= 0, use 0 to log all messages). |
| 32 | + /// </summary> |
| 33 | + public int LoggingVerbosity { get; set; } |
| 34 | + |
22 | 35 | /// <summary> |
23 | 36 | /// Writes the specified string value. |
24 | 37 | /// </summary> |
@@ -47,6 +60,179 @@ public void WriteLine(string value) { } |
47 | 60 | /// <param name="args">Arguments</param> |
48 | 61 | public void WriteLine(string format, params object[] args) { } |
49 | 62 |
|
| 63 | + /// <summary> |
| 64 | + /// Called when an event is about to be enqueued to a machine. |
| 65 | + /// </summary> |
| 66 | + /// <param name="machineId">Id of the machine that the event is being enqueued to.</param> |
| 67 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 68 | + /// <param name="eventName">Name of the event.</param> |
| 69 | + public void OnEnqueue(MachineId machineId, string currentStateName, string eventName) { } |
| 70 | + |
| 71 | + /// <summary> |
| 72 | + /// Called when an event is dequeued by a machine. |
| 73 | + /// </summary> |
| 74 | + /// <param name="machineId">Id of the machine that the event is being dequeued by.</param> |
| 75 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 76 | + /// <param name="eventName">Name of the event.</param> |
| 77 | + public void OnDequeue(MachineId machineId, string currentStateName, string eventName) { } |
| 78 | + |
| 79 | + /// <summary> |
| 80 | + /// Called when the default event handler for a state is about to be executed. |
| 81 | + /// </summary> |
| 82 | + /// <param name="machineId">Id of the machine that the state will execute in.</param> |
| 83 | + /// <param name="currentStateName">Name of the current state of the machine.</param> |
| 84 | + public void OnDefault(MachineId machineId, string currentStateName) { } |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// Called when a machine is being pushed to a state. |
| 88 | + /// </summary> |
| 89 | + /// <param name="machineId">Id of the machine being pushed to the state.</param> |
| 90 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 91 | + /// <param name="newStateName">The state the machine is pushed to.</param> |
| 92 | + public void OnPush(MachineId machineId, string currentStateName, string newStateName) { } |
| 93 | + |
| 94 | + /// <summary> |
| 95 | + /// Called when a machine has been popped from a state. |
| 96 | + /// </summary> |
| 97 | + /// <param name="machineId">Id of the machine that the pop executed in.</param> |
| 98 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 99 | + /// <param name="restoredStateName">The name of the state being restored, if any.</param> |
| 100 | + public void OnPop(MachineId machineId, string currentStateName, string restoredStateName) { } |
| 101 | + |
| 102 | + /// <summary> |
| 103 | + /// When an event cannot be handled in the current state, its exit handler is executed and then the state is |
| 104 | + /// popped and any previous "current state" is reentered. This handler is called when that pop has been done. |
| 105 | + /// </summary> |
| 106 | + /// <param name="machineId">Id of the machine that the pop executed in.</param> |
| 107 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/> (which is being re-entered), if any.</param> |
| 108 | + /// <param name="eventName">The name of the event that cannot be handled.</param> |
| 109 | + public void OnPopUnhandledEvent(MachineId machineId, string currentStateName, string eventName) { } |
| 110 | + |
| 111 | + /// <summary> |
| 112 | + /// Called when an event is received by a machine. |
| 113 | + /// </summary> |
| 114 | + /// <param name="machineId">Id of the machine that received the event.</param> |
| 115 | + /// <param name="eventName">The name of the event.</param> |
| 116 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 117 | + /// <param name="wasBlocked">The machine was waiting for one or more specific events, and <paramref name="eventName"/> was one of them.</param> |
| 118 | + public void OnReceive(MachineId machineId, string currentStateName, string eventName, bool wasBlocked) { } |
| 119 | + |
| 120 | + /// <summary> |
| 121 | + /// Called when a machine enters a wait state. |
| 122 | + /// </summary> |
| 123 | + /// <param name="machineId">Id of the machine that is entering the wait state.</param> |
| 124 | + /// <param name="currentStateName">The name of the current state of <paramref name="machineId"/>, if any.</param> |
| 125 | + /// <param name="eventNames">The names of the specific events being waited for, if any.</param> |
| 126 | + public void OnWait(MachineId machineId, string currentStateName, string eventNames) { } |
| 127 | + |
| 128 | + /// <summary> |
| 129 | + /// Called when an event is sent to a target machine. |
| 130 | + /// </summary> |
| 131 | + /// <param name="targetMachineId">Id of the target machine.</param> |
| 132 | + /// <param name="targetStateName">The name of the current state of the target machine.</param> |
| 133 | + /// <param name="senderId">The machine that sent the event, if any.</param> |
| 134 | + /// <param name="senderStateName">The name of the current state of the sender machine, if applicable |
| 135 | + /// (if it is a non-Machine specialization of an AbstractMachine, it is not applicable).</param> |
| 136 | + /// <param name="eventName">The event being sent.</param> |
| 137 | + /// <param name="operationGroupId">The operation group id, if any.</param> |
| 138 | + /// <param name="isTargetHalted">Is the target machine halted.</param> |
| 139 | + public void OnSend(MachineId targetMachineId, string targetStateName, MachineId senderId, string senderStateName, |
| 140 | + string eventName, Guid? operationGroupId, bool isTargetHalted) { } |
| 141 | + |
| 142 | + /// <summary> |
| 143 | + /// Called when a machine has been created. |
| 144 | + /// </summary> |
| 145 | + /// <param name="machineId">The id of the machine that has been created.</param> |
| 146 | + public void OnCreateMachine(MachineId machineId) { } |
| 147 | + |
| 148 | + /// <summary> |
| 149 | + /// Called when a monitor has been created. |
| 150 | + /// </summary> |
| 151 | + /// <param name="monitorTypeName">The name of the type of the monitor that has been created.</param> |
| 152 | + /// <param name="monitorId">The id of the monitor that has been created.</param> |
| 153 | + public void OnCreateMonitor(string monitorTypeName, MachineId monitorId) { } |
| 154 | + |
| 155 | + /// <summary> |
| 156 | + /// Called when a machine has been halted. |
| 157 | + /// </summary> |
| 158 | + /// <param name="machineId">The id of the machine that has been halted.</param> |
| 159 | + public void OnHalt(MachineId machineId) { } |
| 160 | + |
| 161 | + /// <summary> |
| 162 | + /// Called when a random result has been obtained. |
| 163 | + /// </summary> |
| 164 | + /// <param name="machineId">The id of the source machine, if any; otherwise, the runtime itself was the source.</param> |
| 165 | + /// <param name="result">The random result (may be bool or int).</param> |
| 166 | + public void OnRandom(MachineId machineId, object result) { } |
| 167 | + |
| 168 | + /// <summary> |
| 169 | + /// Called when a machine enters or exits a state. |
| 170 | + /// </summary> |
| 171 | + /// <param name="machineId">The id of the machine entering or exiting the state.</param> |
| 172 | + /// <param name="stateName">The name of the state being entered or exited.</param> |
| 173 | + /// <param name="isEntry">If true, this is called for a state entry; otherwise, exit.</param> |
| 174 | + public void OnMachineState(MachineId machineId, string stateName, bool isEntry) { } |
| 175 | + |
| 176 | + /// <summary> |
| 177 | + /// Called when a machine raises an event. |
| 178 | + /// </summary> |
| 179 | + /// <param name="machineId">The id of the machine raising the event.</param> |
| 180 | + /// <param name="currentStateName">The name of the current state of the machine raising the event.</param> |
| 181 | + /// <param name="eventName">The name of the event being raised.</param> |
| 182 | + public void OnMachineEvent(MachineId machineId, string currentStateName, string eventName) { } |
| 183 | + |
| 184 | + /// <summary> |
| 185 | + /// Called when a machine executes an action. |
| 186 | + /// </summary> |
| 187 | + /// <param name="machineId">The id of the machine executing the action.</param> |
| 188 | + /// <param name="currentStateName">The name of the state in which the action is being executed.</param> |
| 189 | + /// <param name="actionName">The name of the action being executed.</param> |
| 190 | + public void OnMachineAction(MachineId machineId, string currentStateName, string actionName) { } |
| 191 | + |
| 192 | + /// <summary> |
| 193 | + /// Called when a monitor enters or exits a state. |
| 194 | + /// </summary> |
| 195 | + /// <param name="monitorTypeName">The name of the monitor entering or exiting the state.</param> |
| 196 | + /// <param name="monitorId">The id of the monitor entering or exiting the state.</param> |
| 197 | + /// <param name="stateName">The name of the state being entered or exited; if <paramref name="isInHotState"/> |
| 198 | + /// is not null, then the temperature is appended to the statename in brackets, e.g. "stateName[hot]".</param> |
| 199 | + /// <param name="isEntry">If true, this is called for a state entry; otherwise, exit.</param> |
| 200 | + /// <param name="isInHotState">If true, the monitor is in a hot state; if false, the monitor is in a cold state; |
| 201 | + /// else no liveness state is available.</param> |
| 202 | + public void OnMonitorState(string monitorTypeName, MachineId monitorId, string stateName, bool isEntry, bool? isInHotState) { } |
| 203 | + |
| 204 | + /// <summary> |
| 205 | + /// Called when a monitor is about to process or has raised an event. |
| 206 | + /// </summary> |
| 207 | + /// <param name="monitorTypeName">Name of type of the monitor that will process or has raised the event.</param> |
| 208 | + /// <param name="monitorId">Id of the monitor that will process or has raised the event.</param> |
| 209 | + /// <param name="currentStateName">The name of the state in which the event is being raised.</param> |
| 210 | + /// <param name="eventName">The name of the event.</param> |
| 211 | + /// <param name="isProcessing">If true, the monitor is processing the event; otherwise it has raised it.</param> |
| 212 | + public void OnMonitorEvent(string monitorTypeName, MachineId monitorId, string currentStateName, string eventName, bool isProcessing) { } |
| 213 | + |
| 214 | + /// <summary> |
| 215 | + /// Called when a monitor executes an action. |
| 216 | + /// </summary> |
| 217 | + /// <param name="monitorTypeName">Name of type of the monitor that is executing the action.</param> |
| 218 | + /// <param name="monitorId">Name of type of the monitor that is executing the action.</param> |
| 219 | + /// <param name="currentStateName">The name of the state in which the action is being executed.</param> |
| 220 | + /// <param name="actionName">The name of the action being executed.</param> |
| 221 | + public void OnMonitorAction(string monitorTypeName, MachineId monitorId, string currentStateName, string actionName) { } |
| 222 | + |
| 223 | + /// <summary> |
| 224 | + /// Called for general error reporting via pre-constructed text. |
| 225 | + /// </summary> |
| 226 | + /// <param name="text">The text of the error report.</param> |
| 227 | + public void OnError(string text) { } |
| 228 | + |
| 229 | + /// <summary> |
| 230 | + /// Called for errors detected by a specific scheduling strategy. |
| 231 | + /// </summary> |
| 232 | + /// <param name="strategy">The scheduling strategy that was used.</param> |
| 233 | + /// <param name="strategyDescription">More information about the scheduling strategy.</param> |
| 234 | + public void OnStrategyError(SchedulingStrategy strategy, string strategyDescription) { } |
| 235 | + |
50 | 236 | /// <summary> |
51 | 237 | /// Disposes the logger. |
52 | 238 | /// </summary> |
|
0 commit comments