49 | | The EwE Log file, created and managed by the core, and stored in the Windows application data folder, contains a track list of important actions taken by !EwE in response to user requests and a track record of failures and successes. The purpose of the log is to provide postmortem diagnostics when an error has occurred. You can use the log as well in your plug-ins. Frankly, we think you should, because |
| 49 | The EwE Log file, created and managed by the core, and stored in the Windows application data folder, contains a track list of important actions taken by EwE in response to user requests and a track record of failures and successes. The purpose of the log is to provide postmortem diagnostics when an error has occurred. You can use the log as well in your plug-ins. Frankly, we think you should. |
| 50 | |
| 51 | If you strategically encapsulate [#try_/_cath Try / Catch] blocks, why not write the result of the exception to the log file: |
| 52 | |
| 53 | Take for instance the code that runs in response to a 'Run' button click on the Run Ecosim form: |
| 54 | {{{ |
| 55 | Private Sub OnRun(ByVal sender As System.Object, ByVal e As System.EventArgs) _ |
| 56 | Handles m_btnRun.Click |
| 57 | |
| 58 | Try |
| 59 | If Not Me.IsRunning Then |
| 60 | Me.m_iTimeSteps = Me.Core.nEcosimTimeSteps |
| 61 | Me.m_graph.Refresh() |
| 62 | Me.Core.RunEcoSim(AddressOf TimeStepFromEcoSim_handler, True) |
| 63 | End If |
| 64 | Catch ex As Exception |
| 65 | '''cLog.Write(ex, "form RunEcosim.OnRun")''' |
| 66 | End Try |
| 67 | |
| 68 | End Sub |
| 69 | }}} |