Skip to content

Conversation

@jlheflin
Copy link
Contributor

@jlheflin jlheflin commented May 6, 2025

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.

Copy link
Member

@ryanmrichard ryanmrichard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines 191 to 219
.. 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment on lines 183 to 185
********************
Python Example
********************
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not valid reST (the headers/underlines must be the same length as the title).

Comment on lines 152 to 156
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.
Copy link
Member

@jwaldrop107 jwaldrop107 May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants