lbry-sdk/lbrynet/lbrynet_downloader_gui/downloader.py

33 lines
855 B
Python
Raw Normal View History

2015-08-20 17:27:15 +02:00
import logging
import sys
2015-08-28 21:17:28 +02:00
from lbrynet.lbrynet_downloader_gui.DownloaderApp import DownloaderApp
from twisted.internet import reactor, task
import locale
2015-08-20 17:27:15 +02:00
def start_downloader():
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
formatter = logging.Formatter(log_format)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
file_handler = logging.FileHandler("downloader.log")
file_handler.setFormatter(formatter)
file_handler.addFilter(logging.Filter("lbrynet"))
logger.addHandler(file_handler)
2015-08-20 17:27:15 +02:00
sys.stdout = open("downloader.out.log", 'w')
sys.stderr = open("downloader.err.log", 'w')
locale.setlocale(locale.LC_ALL, '')
2015-08-28 21:17:28 +02:00
app = DownloaderApp()
2015-08-20 17:27:15 +02:00
d = task.deferLater(reactor, 0, app.start)
reactor.run()
if __name__ == "__main__":
start_downloader()