Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JDBetteridge committed Jul 27, 2023
1 parent de3e007 commit 0535750
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion gusto/logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
"""Gusto Logging Module
All logging functionality for Gusto is controlled from
``gusto.logging``. A logger object ``logging.getLogger("gusto")`` is
created internally.
The primary means of configuration is via environment variables, the
same way that the standard Python root logger is. See the
:mod:`logging` page for details.
Set ``GUSTO_LOG_LEVEL`` to any of ``DEBUG``, ``INFO``, ``WARNING``,
``ERROR`` or ``CRITICAL`` (from most verbose to least verbose).
Additionally the level of console (`stderr`) logging and logfile based
logging can be controlled separately. Console logging verbosity is set
using ``GUSTO_CONSOLE_LOG_LEVEL``. Logfile logging verbosity is set using
``GUSTO_LOGFILE_LOG_LEVEL``.
By default a script that imports gusto will log only from rank 0 to the
console and to a file. This can be changed by setting the environment
variable ``GUSTO_PARALLEL_LOG`` to ``CONSOLE``, ``FILE`` or ``BOTH``.
Setting these will log from all ranks, not just rank 0. Console output
will be interleaved, but log files contain the rank number as part of
the logfile name.
"""

import logging
import sys
import os
Expand Down Expand Up @@ -98,4 +125,3 @@ def set_log_handler(comm=COMM_WORLD):
logger.addHandler(logging.NullHandler())

logger.info("Running %s" % " ".join(sys.argv))

0 comments on commit 0535750

Please sign in to comment.