use python logging

This commit is contained in:
j 2014-05-17 16:26:59 +02:00
commit 6a8a7b956d
27 changed files with 174 additions and 141 deletions

View file

@ -4,9 +4,12 @@ from __future__ import division
from threading import Thread
import time
import logging
import state
logger = logging.getLogger('oml.downloads')
class Downloads(Thread):
def __init__(self, app):
@ -21,11 +24,11 @@ class Downloads(Thread):
for i in item.models.Item.query.filter(
item.models.Item.transferadded!=None).filter(
item.models.Item.transferprogress<1):
print 'DOWNLOAD', i, i.users
logger.debug('DOWNLOAD %s %s', i, i.users)
for p in i.users:
if state.nodes.check_online(p.id):
r = state.nodes.download(p.id, i)
print 'download ok?', r
logger.debug('download ok? %s', r)
return True
return False