调整版本,实现wifi认证
This commit is contained in:
41
print_color.py
Normal file
41
print_color.py
Normal file
@ -0,0 +1,41 @@
|
||||
from colorama import init, Fore, Back, Style
|
||||
from threading import Lock
|
||||
import datetime
|
||||
|
||||
init() # 初始化colorama
|
||||
print_mutex = Lock()
|
||||
|
||||
def print_normal_msg(*args, **kwargs) :
|
||||
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print_mutex.acquire()
|
||||
print(current_time, *args, **kwargs, end='')
|
||||
print(Style.RESET_ALL)
|
||||
print_mutex.release()
|
||||
|
||||
def print_warning_msg(*args, **kwargs) :
|
||||
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print_mutex.acquire()
|
||||
print(current_time, Fore.LIGHTMAGENTA_EX, *args, **kwargs, end='')
|
||||
print(Style.RESET_ALL)
|
||||
print_mutex.release()
|
||||
|
||||
def print_inform_msg(*args, **kwargs) :
|
||||
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print_mutex.acquire()
|
||||
print(current_time, Fore.YELLOW, *args, **kwargs, end='')
|
||||
print(Style.RESET_ALL)
|
||||
print_mutex.release()
|
||||
|
||||
def print_error_msg(*args, **kwargs) :
|
||||
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print_mutex.acquire()
|
||||
print(current_time, Fore.RED, *args, **kwargs, end='')
|
||||
print(Style.RESET_ALL)
|
||||
print_mutex.release()
|
||||
|
||||
def print_debug_msg(*args, **kwargs) :
|
||||
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print_mutex.acquire()
|
||||
print(current_time, Fore.BLUE, *args, **kwargs, end='')
|
||||
print(Style.RESET_ALL)
|
||||
print_mutex.release()
|
||||
Reference in New Issue
Block a user