added more description to logging and a python example#145
added more description to logging and a python example#145
Conversation
ryanmrichard
left a comment
There was a problem hiding this comment.
It would also be good to have a C++ example. Without the C++ example, a reader may think that this is a Python-only feature.
docs/source/user/runtime_view.rst
Outdated
| value of a computed result usually falls under debug or trace. There's at least | ||
| two ways to do that: | ||
| important and "critical" is the most severe log statements. This means that | ||
| all logging statements set as trace and below are enabled if the severity of |
There was a problem hiding this comment.
| all logging statements set as trace and below are enabled if the severity of | |
| all logging statements with severity trace and above are enabled if the severity of |
docs/source/user/runtime_view.rst
Outdated
| .. code-block:: python | ||
|
|
||
| import parallelzone as pz | ||
|
|
||
| log = pz.runtime.RuntimeView().logger() | ||
| severity = pz.Logger.severity | ||
| severities = [severity.trace, severity.debug, severity.info, severity.warn, severity.error, severity.critical] | ||
|
|
||
| log.set_severity(severity.critical) | ||
|
|
||
| for level in severities: | ||
| log.log(level, "Hello") | ||
|
|
||
| # OUTPUT: | ||
| # [2025-05-06 11:29:54.722] [Rank 0] [critical] Hello | ||
|
|
||
| log.set_severity(severity.trace) | ||
|
|
||
| for level in severities: | ||
| log.log(level, "Hello") | ||
|
|
||
| # OUTPUT: | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [trace] Hello | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [debug] Hello | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [info] Hello | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [warning] Hello | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [error] Hello | ||
| # [2025-05-06 11:33:05.203] [Rank 0] [critical] Hello | ||
|
|
There was a problem hiding this comment.
Please use literalinclude and ensure your code is tested. Please also explain what your code is showing (in your case, it illustrates the difference in output when using different severities).
docs/source/user/runtime_view.rst
Outdated
| ******************** | ||
| Python Example | ||
| ******************** |
There was a problem hiding this comment.
This is not valid reST (the headers/underlines must be the same length as the title).
docs/source/user/runtime_view.rst
Outdated
| the logger is set to trace. If the logger is set to debug, all debug, info, | ||
| warn, error, and critical message logs are enabled, while trace message logs | ||
| are not. For completeness, info includes info, warn, error, critical, and | ||
| warn includes warn, error, critical, and error includes error and critical, | ||
| and critical only includes critical. |
There was a problem hiding this comment.
I honestly think explicitly stating all of these is redundant with the above explanation. I would only provide one explicit example of one of the intermediate values, probably either info or warn.
Is this pull request associated with an issue(s)?
No
Description
Adds a Python example that shows the difference between severity outputs. Also expanded the docs a little bit to better explain this.
TODOs
Should be r2g after review.