kkk2z1 commited on
Commit
b2a9b23
·
verified ·
1 Parent(s): df43544

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -5,19 +5,19 @@ import json
5
  import requests
6
  import traceback
7
  import random
8
-
9
-
10
-
11
- def log(msg,type):
12
- if type == 1:#通常ログ
13
- time_datetime= datetime.now()
14
- print(f"{time_datetime}[log]:{msg}")
15
- elif type == 2: #警告
16
- time_datetime= datetime.now()
17
- print(f"{time_datetime}[warn]:{msg}")
18
- elif type == 3: #エラー
19
- time_datetime= datetime.now()
20
- print(f"{time_datetime}[error]:{msg}")
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":"message","call":"addres"},#0
73
- {"no":3,"by":"name_02","text":"message","call":"addres"},#0
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)#ランダム最大値指定。