Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
fix(logger): change the color semantic for loglevel
  • Loading branch information
hanhxiao committed Aug 30, 2019
1 parent 417f41f commit cee99a63771d330ffa85e8d8e1ceaf80d16036b3
Showing with 8 additions and 9 deletions.
  1. +2 −3 gnes/helper.py
  2. +5 −5 gnes/service/base.py
  3. +1 −1 gnes/service/frontend.py
@@ -191,10 +191,9 @@ class ColoredFormatter(Formatter):
MAPPING = {
'DEBUG': dict(color='white', on_color=None), # white
'INFO': dict(color='white', on_color=None), # cyan
'WARNING': dict(color='red', on_color='on_yellow'), # yellow
'WARNING': dict(color='yellow', on_color='on_grey'), # yellow
'ERROR': dict(color='white', on_color='on_red'), # 31 for red
'CRITICAL': dict(color='red', on_color='on_white'), # white on red bg
'SUCCESS': dict(color='white', on_color='on_green'), # green
'CRITICAL': dict(color='white', on_color='on_green'), # white on red bg
}

PREFIX = '\033['
@@ -255,7 +255,7 @@ def dump(self):
self._model.dump()
self.logger.info('dumping finished!')
else:
self.logger.info('pass dumping as "read_only" set to true.')
self.logger.info('no dumping as "read_only" set to true.')

def message_handler(self, msg: 'gnes_pb2.Message', out_sck, ctrl_sck):
try:
@@ -286,8 +286,8 @@ def message_handler(self, msg: 'gnes_pb2.Message', out_sck, ctrl_sck):
except EventLoopEnd:
send_message(out_sock, msg, timeout=self.args.timeout)
raise EventLoopEnd
except ServiceError as e:
self.logger.error(e)
except ServiceError as ex:
self.logger.error(ex, exc_info=True)

@zmqd.context()
def _run(self, ctx):
@@ -314,7 +314,7 @@ def _run(self, ctx):
self.is_ready.set()
self.is_event_loop.set()
self._start_auto_dump()
self.logger.info(colored('ready and listening', color='white', on_color='on_green'))
self.logger.critical('ready and listening')
while self.is_event_loop.is_set():
pull_sock = None
socks = dict(poller.poll())
@@ -347,7 +347,7 @@ def _run(self, ctx):
in_sock.close()
out_sock.close()
ctrl_sock.close()
self.logger.info('terminated')
self.logger.critical('terminated')

def post_init(self):
pass
@@ -40,7 +40,7 @@ def __init__(self, args):

def __enter__(self):
self.server.start()
self.logger.info('listening at: %s' % self.bind_address)
self.logger.critical('listening at: %s' % self.bind_address)
return self

def __exit__(self, exc_type, exc_val, exc_tb):

0 comments on commit cee99a6

Please sign in to comment.