1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-26 12:59:37 -05:00

Added logging, v0.12.0

This commit is contained in:
Zac Herd 2016-04-19 15:14:11 +01:00
parent e833078d06
commit 24498b5f1d
2 changed files with 10 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
secret.py secret.py
__pycache__ __pycache__
*.json *.json
*.log

10
bot.py
View File

@ -13,6 +13,8 @@ import time
import datetime import datetime
import random import random
import json import json
import logging
import markov import markov
# file in this directory called "secret.py" should contain these variables # file in this directory called "secret.py" should contain these variables
@ -25,7 +27,7 @@ from secret import email,pwd
name = "Maki" name = "Maki"
# bot version # bot version
version = "v0.11.2" version = "v0.12.0"
# text shown by .help command # text shown by .help command
helptext = """I am a bot written in Python by MrDetonia helptext = """I am a bot written in Python by MrDetonia
@ -86,6 +88,12 @@ if os.path.isfile('tells.json'):
# this instance of the Discord client # this instance of the Discord client
client = discord.Client() client = discord.Client()
# logging setup
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
# FUNCTIONS # FUNCTIONS