2016-12-15 07:28:00 +00:00
|
|
|
import os
|
2017-03-27 21:09:36 +00:00
|
|
|
import random
|
2016-12-15 07:28:00 +00:00
|
|
|
from termcolor import colored
|
|
|
|
|
|
|
|
def write_log(data, log_name):
|
|
|
|
logs_dir = os.path.join(os.path.expanduser('~/.cme'), 'logs')
|
|
|
|
with open(os.path.join(logs_dir, log_name), 'w') as log_output:
|
|
|
|
log_output.write(data)
|
|
|
|
|
|
|
|
def highlight(text, color='yellow'):
|
|
|
|
if color == 'yellow':
|
|
|
|
return u'{}'.format(colored(text, 'yellow', attrs=['bold']))
|
|
|
|
elif color == 'red':
|
|
|
|
return u'{}'.format(colored(text, 'red', attrs=['bold']))
|