Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,19 +5,19 @@ import json
|
|
| 5 |
import requests
|
| 6 |
import traceback
|
| 7 |
import random
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
print(f"{time_datetime}[warn]:{msg}")
|
| 18 |
-
elif type == 3:
|
| 19 |
-
time_datetime
|
| 20 |
-
print(
|
| 21 |
traceback.print_exc()
|
| 22 |
|
| 23 |
|
|
@@ -69,8 +69,8 @@ def ramdom_msg():
|
|
| 69 |
date = [
|
| 70 |
{"no":0,"by":"name","text":"message","call":"addres"},#0
|
| 71 |
{"no":1,"by":"name_00","text":"message","call":"addres"},#0
|
| 72 |
-
{"no":2,"by":"name_01","text":"
|
| 73 |
-
{"no":3,"by":"name_02","text":"
|
| 74 |
|
| 75 |
]
|
| 76 |
rand = random.randint(0, 3)#ランダム最大値指定。
|
|
|
|
| 5 |
import requests
|
| 6 |
import traceback
|
| 7 |
import random
|
| 8 |
+
from colorama import Fore, Back, Style, init
|
| 9 |
+
|
| 10 |
+
init(autoreset=True)
|
| 11 |
+
|
| 12 |
+
def log(msg, type):
|
| 13 |
+
time_datetime = datetime.now()
|
| 14 |
+
if type == 1: # 通常ログ(白 or 緑)
|
| 15 |
+
print(f"{Fore.GREEN}{time_datetime}[log]: {msg}")
|
| 16 |
+
elif type == 2: # 警告(黄色)
|
| 17 |
+
print(f"{Fore.YELLOW}{time_datetime}[warn]: {msg}")
|
| 18 |
+
elif type == 3: # エラー(赤)
|
| 19 |
+
print(f"{Fore.RED}{time_datetime}[error]: {msg}")
|
| 20 |
+
print(Fore.RED)
|
| 21 |
traceback.print_exc()
|
| 22 |
|
| 23 |
|
|
|
|
| 69 |
date = [
|
| 70 |
{"no":0,"by":"name","text":"message","call":"addres"},#0
|
| 71 |
{"no":1,"by":"name_00","text":"message","call":"addres"},#0
|
| 72 |
+
{"no":2,"by":"name_01","text":"message_02","call":"addres"},#0
|
| 73 |
+
{"no":3,"by":"name_02","text":"message_03","call":"addres"},#0
|
| 74 |
|
| 75 |
]
|
| 76 |
rand = random.randint(0, 3)#ランダム最大値指定。
|