Nicer colour output for coordinator state client
This commit is contained in:
parent
e765ec7f49
commit
2a220cd16e
|
@ -27,6 +27,8 @@ def red():
|
||||||
return '\033[91m'
|
return '\033[91m'
|
||||||
def blue():
|
def blue():
|
||||||
return '\033[94m'
|
return '\033[94m'
|
||||||
|
def cyan():
|
||||||
|
return '\033[96m'
|
||||||
def green():
|
def green():
|
||||||
return '\033[92m'
|
return '\033[92m'
|
||||||
def yellow():
|
def yellow():
|
||||||
|
|
|
@ -238,7 +238,7 @@ def getOutputColours(node_information):
|
||||||
elif node_information['coordinator_state'] == 'secondary':
|
elif node_information['coordinator_state'] == 'secondary':
|
||||||
coordinator_state_colour = ansiprint.blue()
|
coordinator_state_colour = ansiprint.blue()
|
||||||
else:
|
else:
|
||||||
coordinator_state_colour = ansiprint.purple()
|
coordinator_state_colour = ansiprint.cyan()
|
||||||
|
|
||||||
if node_information['domain_state'] == 'ready':
|
if node_information['domain_state'] == 'ready':
|
||||||
domain_state_colour = ansiprint.green()
|
domain_state_colour = ansiprint.green()
|
||||||
|
|
|
@ -330,6 +330,7 @@ if config['log_colours']:
|
||||||
fmt_end = logger.fmt_end
|
fmt_end = logger.fmt_end
|
||||||
fmt_bold = logger.fmt_bold
|
fmt_bold = logger.fmt_bold
|
||||||
fmt_blue = logger.fmt_blue
|
fmt_blue = logger.fmt_blue
|
||||||
|
fmt_cyan = logger.fmt_cyan
|
||||||
fmt_green = logger.fmt_green
|
fmt_green = logger.fmt_green
|
||||||
fmt_yellow = logger.fmt_yellow
|
fmt_yellow = logger.fmt_yellow
|
||||||
fmt_red = logger.fmt_red
|
fmt_red = logger.fmt_red
|
||||||
|
@ -1242,12 +1243,18 @@ def update_zookeeper():
|
||||||
|
|
||||||
# Display node information to the terminal
|
# Display node information to the terminal
|
||||||
if config['log_keepalives']:
|
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(
|
logger.out(
|
||||||
'{}{} keepalive{} [{}{}{}]'.format(
|
'{}{} keepalive{} [{}{}{}]'.format(
|
||||||
fmt_purple,
|
fmt_purple,
|
||||||
myhostname,
|
myhostname,
|
||||||
fmt_end,
|
fmt_end,
|
||||||
fmt_bold,
|
fmt_bold + cst_colour,
|
||||||
this_node.router_state,
|
this_node.router_state,
|
||||||
fmt_end
|
fmt_end
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue