7
PURPOSE: GRASS debugging
9
from debug import Debug as Debug
10
Debug.msg (3, 'debug message')
12
AUTHORS: The GRASS Development Team
13
Martin Landa <landa.martin gmail.com>
15
COPYRIGHT: (C) 2007-2008 by the GRASS Development Team
16
This program is free software under the GNU General Public
17
License (>=v2). Read the file COPYING that comes with GRASS
30
export GRASS_WX_DEBUG=[0-5]
38
def _update_level(self):
39
debug = os.getenv("GRASS_WX_DEBUG")
42
# only GUI debug messages [GUI:level]
43
level = int (debug[-1])
45
level = self.debuglevel
47
if self.debuglevel != level:
48
self.debuglevel = level
50
def msg (self, level, message):
52
if self.debuglevel > 0 and level > 0 and level <= self.debuglevel:
53
print >> sys.stderr, "GUI D%d/%d: %s" % (level, self.debuglevel, message)
54
sys.stderr.flush() # force flush (required for MS Windows)
57
"""Return current GUI debug level"""
58
return self.debuglevel
64
if __name__ == "__main__":
66
gcmd.Command (cmd=["g.gisenv", "set=DEBUG=3"])
68
for level in range (4):
69
Debug.msg (level, "message level=%d" % level)