~marcosvanetta/+junk/finop

« back to all changes in this revision

Viewing changes to main.py

  • Committer: Marcos Vanetta
  • Date: 2010-04-21 21:57:06 UTC
  • Revision ID: marcosvanetta@gmail.com-20100421215706-046jx16am69j802e
starting refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
import logging
16
16
import sys
17
17
import yaml
18
 
from config import HOST, PORT, LOG_FILE
 
18
from config import HOST, PORT, LOG_FILE, CHANNEL
19
19
from twitedbot import IRCFactory
20
20
from twisted.internet import reactor
21
21
 
22
 
logging.basicConfig(filename = LOG_FILE)
23
 
 
24
 
# End logging configuration
25
 
#logging.debug('This is a debug message')
26
 
#logging.info('This is an info message')
27
 
#logging.warning('This is a warning message')
28
 
#logging.error('This is an error message')
29
 
#logging.critical('This is a critical error message')
 
22
logging.basicConfig(filename = LOG_FILE, level=logging.INFO)
 
23
logging.debug("starting!")
30
24
 
31
25
if __name__ == '__main__':
32
26
    print __doc__
33
 
    reactor.connectTCP(HOST, PORT, IRCFactory())
 
27
    reactor.connectTCP(HOST, PORT, IRCFactory(CHANNEL))
34
28
    reactor.run()
35
29
 
 
30
def run(flags=None):
 
31
    # loads config and assigns variables
 
32
    config = yaml.load(open("user_info.yaml", "r"))
 
33
    factory = protocol.ClientCreator(reactor, Failure, flags, config)
 
34
    factory.connectTCP(config["server"], int(config["port"]))
 
35
    reactor.run()