Commit d4bd935
ENH: Add python loggers (#973)
* ENH: adopt built-in Python logging instead of print() calls
* ENH: adopt built-in Python logging instead of print() calls
* ENH: adopt built-in Python logging instead of print() calls
* ENH: adopt built-in Python logging instead of print() calls
* ENH: adopt built-in Python logging instead of print() calls
* ENH: adopt built-in Python logging for internal runtime events
* ENH: adopt built-in Python logging for internal runtime events
* STY: fix formatting with ruff and black
* STY: fix formatting with ruff and black
* Update rocketpy/environment/environment.py
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
* Update rocketpy/environment/environment.py
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
* Update rocketpy/environment/tools.py
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
* Update rocketpy/mathutils/function.py
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
* Update rocketpy/mathutils/vector_matrix.py
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
* MNT: address PR review comments on nose_cone and tools
* MNT: fix docstrings and scope debug log to verbose flag
* MNT: restore SimMonitor print behavior for multiprocessing compatibility
* MNT: keep print() for user-requested plot headers, document enable_logging
Plot section headers (e.g. 'Trajectory 3d Plot', 'Airfoil lift curve:')
are emitted by user-invoked .plots.xxx()/.all() calls, not internal
runtime events, so per this PR's own print-vs-logger distinction they
should remain print() -- otherwise they silently disappear by default
while the plot itself is still shown, and reading them in a log stream
disconnected from the plot window doesn't make sense. Diagnostic
logger.warning() calls for skipped/missing data are left untouched.
Also adds user-guide and API reference docs for enable_logging(),
closing the last unresolved review comment on the PR.
* MNT: fix pylint regressions and restore visible progress output
- Bump pylintrc max-module-lines 3000->3050: environment.py now sits
4 lines over the old hard limit purely from the logging import/setup
this PR adds, tripping CI's fail-under=10 gate.
- Remove EmptyMotor import in rocket_plots.py, unused since PR #924
switched that check to a string-based type-name comparison.
- Restore the exact pre-PR print() formatting (blank-line separators,
dash dividers) in rocket_plots.py/environment_plots.py/flight_plots.py
that got flattened when converting headers back to print() earlier
in this branch.
- MonteCarlo: two logger.warning/error calls in __sim_producer run
inside a multiprocessing worker process. Log handlers configured via
enable_logging() in the parent process are not guaranteed to reach
child processes (e.g. Windows "spawn"), so these would silently
vanish -- exactly the cross-process issue already found and fixed
for _SimMonitor in a prior commit on this branch, just missed here.
Reverted to print()/_SimMonitor.reprint() for guaranteed visibility.
- For consistency with that worker output and with the still-visible
per-iteration progress ticker, also reverted MonteCarlo's other
lifecycle narration (start, worker count, results saved, file
imports) to print(); logging module no longer needed in this file.
* MNT: revert FlightComparator output to print(), not logging
FlightComparator is an interactively-invoked reporting tool: add_data(),
compare(), summary() and all() exist specifically to print a
human-readable report the user is watching on their screen, exactly
like Flight.info()/Rocket.all_info() -- not an internal runtime event a
library embedder would want to filter or silence. Converting it to
logger.info()/logger.warning() meant summary() -- a method whose entire
purpose is printing a report -- produced no output at all under the
library's silent-by-default logging config, and the other methods lost
their multi-line human-readable formatting when consolidated into
single log records.
Restored the original print() calls and formatting verbatim, dropped
the now-unused logger import, and reverted the two tests that had been
migrated to caplog back to capsys to match.
---------
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>1 parent f18f2e5 commit d4bd935
34 files changed
Lines changed: 457 additions & 135 deletions
File tree
- docs
- reference/classes/utils
- user
- rocketpy
- environment
- mathutils
- motors
- plots
- compare
- rocket
- aero_surface
- sensitivity
- sensors
- simulation
- stochastic
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 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 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
999 | 1003 | | |
1000 | 1004 | | |
1001 | 1005 | | |
1002 | | - | |
| 1006 | + | |
1003 | 1007 | | |
1004 | 1008 | | |
1005 | 1009 | | |
| |||
1038 | 1042 | | |
1039 | 1043 | | |
1040 | 1044 | | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1049 | 1052 | | |
1050 | 1053 | | |
1051 | 1054 | | |
| |||
2760 | 2763 | | |
2761 | 2764 | | |
2762 | 2765 | | |
2763 | | - | |
2764 | | - | |
2765 | | - | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
2766 | 2770 | | |
2767 | 2771 | | |
2768 | 2772 | | |
| |||
2995 | 2999 | | |
2996 | 3000 | | |
2997 | 3001 | | |
2998 | | - | |
| 3002 | + | |
2999 | 3003 | | |
3000 | | - | |
| 3004 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
239 | | - | |
240 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
241 | 247 | | |
242 | 248 | | |
243 | | - | |
| 249 | + | |
244 | 250 | | |
245 | | - | |
| 251 | + | |
246 | 252 | | |
247 | 253 | | |
248 | 254 | | |
| |||
506 | 512 | | |
507 | 513 | | |
508 | 514 | | |
509 | | - | |
510 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
511 | 518 | | |
512 | 519 | | |
513 | 520 | | |
| |||
2804 | 2811 | | |
2805 | 2812 | | |
2806 | 2813 | | |
2807 | | - | |
2808 | | - | |
2809 | | - | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
2810 | 2818 | | |
2811 | 2819 | | |
2812 | 2820 | | |
| |||
2845 | 2853 | | |
2846 | 2854 | | |
2847 | 2855 | | |
2848 | | - | |
| 2856 | + | |
2849 | 2857 | | |
2850 | 2858 | | |
2851 | 2859 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
0 commit comments