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