10
from core.debug import Debug
11
Debug.msg (3, 'debug message')
14
(C) 2007-2009, 2011 by the GRASS Development Team
16
This program is free software under the GNU General Public License
17
(>=v2). Read the file COPYING that comes with GRASS for details.
19
@author Martin Landa <landa.martin gmail.com>
25
import grass.script as grass
30
g.gisenv set=WX_DEBUG=[0-5]
40
"""Initialize gui debug level
42
self.debuglevel = int(grass.gisenv().get('WX_DEBUG', 0))
44
def msg(self, level, message, *args):
45
"""Print debug message
47
:param level: debug level (0-5)
48
:param message: message to be printed
49
:param args: formatting params
52
if self.debuglevel > 0 and level > 0 and level <= self.debuglevel:
54
sys.stderr.write("GUI D%d/%d: " % (level, self.debuglevel) + \
55
message % args + os.linesep)
57
sys.stderr.write("GUI D%d/%d: " % (level, self.debuglevel) + \
59
sys.stderr.flush() # force flush (required for MS Windows)
62
"""Return current GUI debug level"""
63
return self.debuglevel