forked from ticketfrei/ticketfrei
fix logging
This commit is contained in:
parent
97e0566759
commit
32278bed15
|
@ -10,7 +10,7 @@ from bot import Bot
|
|||
from config import config
|
||||
from db import db
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
class Mailbot(Bot):
|
||||
|
|
|
@ -7,7 +7,7 @@ import re
|
|||
from report import Report
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
class MastodonBot(Bot):
|
||||
|
|
|
@ -2,10 +2,8 @@ from bot import Bot
|
|||
import logging
|
||||
from report import Report
|
||||
from twx.botapi import TelegramBot as Telegram
|
||||
from time import sleep
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
class TelegramBot(Bot):
|
||||
|
@ -89,7 +87,6 @@ class TelegramBot(Bot):
|
|||
try:
|
||||
for subscriber_id in user.get_telegram_subscribers():
|
||||
tb.send_message(subscriber_id, text).wait()
|
||||
sleep(0.5)
|
||||
except Exception:
|
||||
logger.error('Error telegramming: ' + user.get_city() + ': '
|
||||
+ str(report.id), exc_info=True)
|
||||
|
|
|
@ -9,7 +9,7 @@ import report
|
|||
from bot import Bot
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
class TwitterBot(Bot):
|
||||
|
|
|
@ -16,7 +16,7 @@ def shutdown():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger = logging.getLogger("main")
|
||||
fh = logging.FileHandler('/var/log/ticketfrei/backend.log')
|
||||
fh.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter('%(asctime)s %(levelname)8s: %(message)s')
|
||||
|
@ -34,7 +34,7 @@ if __name__ == '__main__':
|
|||
while True:
|
||||
for user in db.active_users:
|
||||
for bot in bots:
|
||||
sleep(5)
|
||||
sleep(1)
|
||||
reports = bot.crawl(user)
|
||||
for status in reports:
|
||||
if not user.is_appropriate(status):
|
||||
|
|
2
db.py
2
db.py
|
@ -7,7 +7,7 @@ import sqlite3
|
|||
from time import sleep, time
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
class DB(object):
|
||||
|
|
|
@ -8,7 +8,7 @@ import smtplib
|
|||
from socket import getfqdn
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger("main")
|
||||
|
||||
|
||||
def sendmail(to, subject, city=None, body=''):
|
||||
|
|
Loading…
Reference in a new issue