Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions docs/source/user/runtime_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,17 @@ meanings):
- critical - Something went wrong, but recovery is not possible

Severity increases from "trace" to "critical" such that "trace" is the least
important and "critical" is the most severe log statements. In practice, the
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

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.



In practice, the value of a computed result usually falls under debug or
trace. There's at least two ways to do that:

.. tabs::

Expand All @@ -172,6 +180,43 @@ level has its own corresponding method. The second example shows how to use
the more general ``log`` method. This particular overload of the ``log`` method
allows you to specify (at runtime if you like) the severity of the message.

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


.. tabs::

.. tab:: Python

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

.. note::

Notice that we did not discuss where the log message gets printed. This is
Expand Down