refactor logging

pull/19/head
deadc0de6 4 years ago
parent 6d7f95a6ae
commit f0495e6d00

@ -212,8 +212,8 @@ def cmd_edit(args, noder, catalog, top):
def banner():
Logger.log(BANNER)
Logger.log("")
Logger.out(BANNER)
Logger.out("")
def main():

@ -71,17 +71,17 @@ class Logger:
# generic output
######################################################################
def out(string):
'''to stdout'''
'''to stdout no color'''
sys.stdout.write('{}\n'.format(string))
def log(string):
'''to stderr'''
def debug(string):
'''to stderr no color'''
sys.stderr.write('{}\n'.format(string))
def info(string):
'''to stderr in color'''
'''to stdout in color'''
s = '{}{}{}'.format(Logger.MAGENTA, string, Logger.RESET)
sys.stderr.write('{}\n'.format(s))
sys.stdout.write('{}\n'.format(s))
def err(string):
'''to stderr in RED'''

@ -484,4 +484,4 @@ class Noder:
def _debug(self, string):
if not self.verbose:
return
Logger.info(string)
Logger.debug(string)

@ -131,7 +131,7 @@ class Walker:
def _debug(self, string):
if not self.debug:
return
Logger.log(string)
Logger.debug(string)
def _log(self, string):
if self.debug:

Loading…
Cancel
Save