1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 10:31:26 +00:00

adding more debugging info

This commit is contained in:
deadc0de6
2018-05-02 21:08:52 +02:00
parent 927d76779f
commit f68ddeb06f
4 changed files with 24 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ handle logging to stdout/stderr
"""
import sys
import inspect
class Logger:
@@ -46,9 +47,14 @@ class Logger:
sys.stderr.write('%s[WARN] %s %s%s' % (cs, string, end, ce))
def dbg(self, string):
if not self.debug:
return
frame = inspect.stack()[1]
mod = inspect.getmodule(frame[0]).__name__
func = inspect.stack()[1][3]
cs = self._color(self.MAGENTA)
ce = self._color(self.RESET)
sys.stderr.write('%s[DEBUG] %s%s\n' % (cs, string, ce))
sys.stderr.write('%s[DEBUG][%s.%s] %s%s\n' % (cs, mod, func, string, ce))
def dry(self, string, end='\n'):
cs = self._color(self.GREEN)