Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grass.script: Explain setting of debug level #2313

Merged
merged 4 commits into from
Jun 2, 2022
Merged
Changes from 2 commits
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
17 changes: 14 additions & 3 deletions python/grass/script/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from grass.script import core as grass
grass.parser()

(C) 2008-2021 by the GRASS Development Team
(C) 2008-2022 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
Expand Down Expand Up @@ -737,10 +737,21 @@ def message(msg, flag=None):


def debug(msg, debug=1):
"""Display a debugging message using `g.message -d`
"""Display a debugging message using `g.message -d`.

The visibility of a debug message at runtime is controlled by
setting the corresponding DEBUG level with `g.gisenv set="DEBUG=X"`
(with `X` set to the debug level specified in the function call).

:param str msg: debugging message to be displayed
:param str debug: debug level (0-5)
:param str debug: debug level (0-5) with the following recommended levels:

::

0 - silence
1 - message is printed once or few times per module
3 - each row (raster) or line (vector)
5 - each cell (raster) or point (vector)
"""
if debug_level() >= debug:
# TODO: quite a random hack here, do we need it somewhere else too?
Expand Down