log
The module containing PROCESS' custom log handler.
This handler is designed to capture logs during the output phase of a run--when the models are being run for the final time. This ensures captured logs are relevant for the solution that is written to the MFile.
ProcessLogHandler
Bases: Handler
PROCESS' custom log handler that stores captured logs on the handler.
The handler will only store logs when an internal attribute _capturing is True. This can be changed by setting the capturing keyword when instantiating the handler or using the methods start_capturing/stop_capturing.
Source code in process/core/log.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
start_capturing()
Start capturing logs and storing them within the handler.
Source code in process/core/log.py
33 34 35 | |
stop_capturing()
Stop capturing logs and storing them within the handler.
Source code in process/core/log.py
37 38 39 | |
emit(record)
Method called when creating a logging record (e.g. logger.warning).
Source code in process/core/log.py
41 42 43 44 | |
render_warnings()
Render the stored warnings for printing to the terminal or OUTFile.
Source code in process/core/log.py
54 55 56 57 58 | |
show_errors(file_unit)
Write the rendered captured logs to the terminal/OUTFile
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_unit
|
int
|
a number describing the output medium (terminal, OUTFile) |
required |
Source code in process/core/log.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |