initialisation des logs
This commit is contained in:
parent
0f2acfdabf
commit
f8c58fe7ac
1 changed files with 22 additions and 0 deletions
|
@ -8,6 +8,7 @@ import asyncio
|
|||
import discord
|
||||
import giphy_client
|
||||
import gitlab
|
||||
import loggi,g
|
||||
import lxml
|
||||
import os
|
||||
import random
|
||||
|
@ -17,12 +18,32 @@ import youtube_dl
|
|||
from bs4 import BeautifulSoup as bs
|
||||
from discord.ext import tasks, commands
|
||||
from giphy_client.rest import ApiException
|
||||
from logging.handlers import RotatingFileHandler
|
||||
from pathlib import Path
|
||||
from subprocess import *
|
||||
from sys import argv
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
## création de l'objet logger
|
||||
logger = logging.etLogger()
|
||||
## definition du log level
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
## format du log
|
||||
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
|
||||
|
||||
# definition du fichier de log (chemin, level, etc ...)
|
||||
file_handler = RotatingFileHandler('/var/log/kabot.log', 'a', 1000000, 1)
|
||||
file_handler.setLevel(logging.DEBUG)
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
|
||||
# definition de l'affichage des logs dans la console
|
||||
stream_handler = logging.StreamHandler()
|
||||
stream_handler.setLevel(logging.DEBUG)
|
||||
logger.addHandler(stream_handler)
|
||||
|
||||
class Mybot(commands.Cog):
|
||||
#Fonctions necesaires pour Kabot.
|
||||
def __init__(self, bot):
|
||||
|
@ -459,6 +480,7 @@ def get_word(word_type):
|
|||
|
||||
#Le do[main]e de Kabot.
|
||||
def main():
|
||||
logger.info("Initialisation de Kabot")
|
||||
token = "NjI3MTM3NDY1MDA5ODMxOTQ2.XY4Raw.pw8sAen3bNR5aYsoTChQOudM0L8"
|
||||
bot = commands.Bot(command_prefix='!')
|
||||
|
||||
|
|
Loading…
Reference in a new issue