mirror of
https://github.com/2noise/ChatTTS.git
synced 2026-08-29 02:10:59 +08:00
fix(colab): color log printing (#430)
This commit is contained in:
Vendored
+1
-1
@@ -72,7 +72,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"logger = get_logger(\"ChatTTS\", remove_exist=True)\n",
|
||||
"logger = get_logger(\"ChatTTS\", format_root=True)\n",
|
||||
"chat = ChatTTS.Chat(logger)\n",
|
||||
"\n",
|
||||
"# try to load normalizer\n",
|
||||
|
||||
+4
-1
@@ -51,7 +51,7 @@ class Formatter(logging.Formatter):
|
||||
return logstr
|
||||
|
||||
|
||||
def get_logger(name: str, lv = logging.INFO, remove_exist=False):
|
||||
def get_logger(name: str, lv = logging.INFO, remove_exist=False, format_root=False):
|
||||
logger = logging.getLogger(name)
|
||||
logger.setLevel(lv)
|
||||
if remove_exist and logger.hasHandlers():
|
||||
@@ -63,4 +63,7 @@ def get_logger(name: str, lv = logging.INFO, remove_exist=False):
|
||||
else:
|
||||
for h in logger.handlers:
|
||||
h.setFormatter(Formatter())
|
||||
if format_root:
|
||||
for h in logger.root.handlers:
|
||||
h.setFormatter(Formatter())
|
||||
return logger
|
||||
|
||||
Reference in New Issue
Block a user