-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogs.py
More file actions
29 lines (23 loc) · 1.05 KB
/
logs.py
File metadata and controls
29 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from datetime import datetime
from colorama import Fore, Style, init
from discord_webhook import *
import json
with open("access.json",'r') as accessFile:
jsonFile = json.load(accessFile)
ErrorWebhookUrl = jsonFile['Keys']['ErrorWebhookUrl']
init(convert=True)
init(autoreset=True)
def log(content):
print(f'[{datetime.now()}] {Fore.LIGHTMAGENTA_EX}{content}{Style.RESET_ALL}')
def log_info(content):
print(f'[{datetime.now()}] {Fore.YELLOW}{content}{Style.RESET_ALL}')
def log_success(content):
print(f'[{datetime.now()}] {Fore.LIGHTGREEN_EX}{content}{Style.RESET_ALL}')
def log_error(content):
print(f'[{datetime.now()}] {Fore.LIGHTRED_EX}{content}{Style.RESET_ALL}')
webhook = DiscordWebhook(url=ErrorWebhookUrl, username ="Error Monitor",avatar_url='https://i.imgur.com/RWFzrEi.png')
embed = DiscordEmbed(title="Wykryto Error", color='0x50d68d')
embed.add_embed_field(name='Error:', value=f"{content}",inline=True)
embed.set_timestamp()
webhook.add_embed(embed)
webhook.execute()