Closed anschweitzer closed 1 year ago
Merging #119 (6897acd) into main (bf946c8) will decrease coverage by
0.27%
. The diff coverage is87.50%
.
@@ Coverage Diff @@
## main #119 +/- ##
==========================================
- Coverage 94.38% 94.10% -0.28%
==========================================
Files 220 226 +6
Lines 11370 11849 +479
==========================================
+ Hits 10732 11151 +419
- Misses 638 698 +60
Impacted Files | Coverage Δ | |
---|---|---|
gw_spaceheat/logging_setup.py | 48.19% <48.19%> (ø) |
|
gw_spaceheat/actors2/scada2.py | 83.58% <56.25%> (-1.15%) |
:arrow_down: |
gw_spaceheat/proactor/proactor_implementation.py | 86.50% <78.84%> (+1.15%) |
:arrow_up: |
gw_spaceheat/proactor/logger.py | 87.30% <87.30%> (ø) |
|
test/conftest.py | 93.07% <89.28%> (-2.93%) |
:arrow_down: |
gw_spaceheat/actors/actor_base.py | 83.91% <100.00%> (-1.30%) |
:arrow_down: |
gw_spaceheat/actors/cloud_base.py | 82.11% <100.00%> (-1.50%) |
:arrow_down: |
gw_spaceheat/actors/scada_base.py | 86.11% <100.00%> (-2.63%) |
:arrow_down: |
gw_spaceheat/actors/utils.py | 87.87% <100.00%> (+4.85%) |
:arrow_up: |
gw_spaceheat/command_line_utils.py | 60.86% <100.00%> (+0.05%) |
:arrow_up: |
... and 16 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Articulates an approach to logging:
logging
module is used in place of print()$HOME/.local/state/gridworks/scada/scada.log
.Intended usage:
starting a script:
Logging setup at the beginning of a script:
In message processing:
Some notable caveats and observations:
The default format is now
2022-09-22 20:38:35.617 message
.print() should not be used. Instead use a python logging library logger. the
_logger
member of Scada2 and Proactor provides access to several loggers.The string construction style is printf-style/'%' based, e.g.:
any logger can be accessed with
logging.getLogger("logger.name")
Our logger names are currently:
screen_print() in the old code has not been updated. I'm hoping we can replace the old code with new code that can feed sensors over mqtt on remote machines without too much trouble.