diff --git a/log.py b/log.py index 231f940..a68b73b 100644 --- a/log.py +++ b/log.py @@ -1,5 +1,15 @@ import logging -logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(levelname)s] %(message)s') +import sys +from conf import conf + +level = conf['bot']['loglevel'].upper() +try: + level = getattr(logging, level) +except AttributeError: + print('ERROR: Invalid log level %r specified in config.' % level) + sys.exit(3) + +logging.basicConfig(level=level, format='%(asctime)s [%(levelname)s] %(message)s') global log log = logging.getLogger() diff --git a/protocols/inspircd.py b/protocols/inspircd.py index d7f548c..4b3ed98 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -142,7 +142,9 @@ def connect(irc): f('SERVER {host} {Pass} 0 {sid} :PyLink Service'.format(host=host, Pass=irc.serverdata["sendpass"], sid=irc.sid)) f(':%s BURST %s' % (irc.sid, ts)) - irc.pseudoclient = spawnClient(irc, 'PyLink', 'pylink', host, modes=set([("+o", None)])) + nick = conf['bot'].get('nick') or 'PyLink' + ident = conf['bot'].get('ident') or 'pylink' + irc.pseudoclient = spawnClient(irc, nick, ident, host, modes={("+o", None)}) f(':%s ENDBURST' % (irc.sid)) for chan in irc.serverdata['channels']: joinClient(irc, irc.pseudoclient.uid, chan)