Nicer colour output for coordinator state client

This commit is contained in:
Joshua Boniface 2019-07-12 09:31:42 -04:00
parent e765ec7f49
commit 2a220cd16e
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,8 @@ def red():
return '\033[91m'
def blue():
return '\033[94m'
def cyan():
return '\033[96m'
def green():
return '\033[92m'
def yellow():

View File

@ -238,7 +238,7 @@ def getOutputColours(node_information):
elif node_information['coordinator_state'] == 'secondary':
coordinator_state_colour = ansiprint.blue()
else:
coordinator_state_colour = ansiprint.purple()
coordinator_state_colour = ansiprint.cyan()
if node_information['domain_state'] == 'ready':
domain_state_colour = ansiprint.green()

View File

@ -330,6 +330,7 @@ if config['log_colours']:
fmt_end = logger.fmt_end
fmt_bold = logger.fmt_bold
fmt_blue = logger.fmt_blue
fmt_cyan = logger.fmt_cyan
fmt_green = logger.fmt_green
fmt_yellow = logger.fmt_yellow
fmt_red = logger.fmt_red
@ -1242,12 +1243,18 @@ def update_zookeeper():
# Display node information to the terminal
if config['log_keepalives']:
if this_node.router_state == 'primary':
cst_colour = fmt_green
elif this_node.router_state == 'secondary':
cst_colour = fmt_blue
else:
cst_colour = fmt_cyan
logger.out(
'{}{} keepalive{} [{}{}{}]'.format(
fmt_purple,
myhostname,
fmt_end,
fmt_bold,
fmt_bold + cst_colour,
this_node.router_state,
fmt_end
),