improve logging

This commit is contained in:
Jack 2016-09-14 22:28:59 -04:00
parent 2b1af8eea2
commit b010192f8e
5 changed files with 15 additions and 9 deletions

View file

@ -70,7 +70,7 @@ class DownloadManager(object):
def add_blob_to_list(blob, blob_num): def add_blob_to_list(blob, blob_num):
self.blobs[blob_num] = blob self.blobs[blob_num] = blob
log.info("Added blob (hash: %s, number %s) to the list", str(blob.blob_hash), str(blob_num)) log.debug("Added blob (hash: %s, number %s) to the list", str(blob.blob_hash), str(blob_num))
def error_during_add(err): def error_during_add(err):
log.warning("An error occurred adding the blob to blobs. Error:%s", err.getErrorMessage()) log.warning("An error occurred adding the blob to blobs. Error:%s", err.getErrorMessage())

View file

@ -86,6 +86,12 @@ def disable_noisy_loggers():
logging.getLogger('lbrynet.core.server.BlobAvailabilityHandler').setLevel(logging.INFO) logging.getLogger('lbrynet.core.server.BlobAvailabilityHandler').setLevel(logging.INFO)
logging.getLogger('lbrynet.dht').setLevel(logging.INFO) logging.getLogger('lbrynet.dht').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbrynet_daemon.LBRYExchangeRateManager').setLevel(logging.INFO) logging.getLogger('lbrynet.lbrynet_daemon.LBRYExchangeRateManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbrynet_daemon.LBRYDaemon').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.LBRYWallet').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbryfile.LBRYFileMetadataManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.client.DownloadManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbryfilemanager.LBRYFileManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.server.BlobRequestHandler').setLevel(logging.INFO)
@_log_decorator @_log_decorator

View file

@ -78,11 +78,11 @@ class BlobRequestHandler(object):
if read_handle is not None: if read_handle is not None:
self.currently_uploading = blob self.currently_uploading = blob
self.read_handle = read_handle self.read_handle = read_handle
log.debug("Sending %s to client", str(blob)) log.info("Sending %s to client", str(blob))
response_fields['blob_hash'] = blob.blob_hash response_fields['blob_hash'] = blob.blob_hash
response_fields['length'] = blob.length response_fields['length'] = blob.length
return response return response
log.debug("We can not send %s", str(blob)) log.warning("We can not send %s", str(blob))
response_fields['error'] = "BLOB_UNAVAILABLE" response_fields['error'] = "BLOB_UNAVAILABLE"
return response return response
@ -132,13 +132,13 @@ class BlobRequestHandler(object):
def start_transfer(): def start_transfer():
self.file_sender = FileSender() self.file_sender = FileSender()
log.info("Starting the file upload") log.debug("Starting the file upload")
assert self.read_handle is not None, "self.read_handle was None when trying to start the transfer" assert self.read_handle is not None, "self.read_handle was None when trying to start the transfer"
d = self.file_sender.beginFileTransfer(self.read_handle, consumer, count_bytes) d = self.file_sender.beginFileTransfer(self.read_handle, consumer, count_bytes)
return d return d
def set_expected_payment(): def set_expected_payment():
log.info("Setting expected payment") log.debug("Setting expected payment")
if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None: if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None:
# TODO: explain why 2**20 # TODO: explain why 2**20
self.wallet.add_expected_payment(self.peer, self.wallet.add_expected_payment(self.peer,

View file

@ -236,7 +236,7 @@ class DBLBRYFileMetadataManager(object):
@rerun_if_locked @rerun_if_locked
def _get_sd_blob_hashes_for_stream(self, stream_hash): def _get_sd_blob_hashes_for_stream(self, stream_hash):
log.info("Looking up sd blob hashes for stream hash %s", str(stream_hash)) log.debug("Looking up sd blob hashes for stream hash %s", str(stream_hash))
d = self.db_conn.runQuery("select sd_blob_hash from lbry_file_descriptors where stream_hash = ?", d = self.db_conn.runQuery("select sd_blob_hash from lbry_file_descriptors where stream_hash = ?",
(stream_hash,)) (stream_hash,))
d.addCallback(lambda results: [r[0] for r in results]) d.addCallback(lambda results: [r[0] for r in results])

View file

@ -82,9 +82,9 @@ class LBRYFileManager(object):
def log_error(err, rowid, stream_hash, options): def log_error(err, rowid, stream_hash, options):
log.error("An error occurred while starting a lbry file: %s", err.getErrorMessage()) log.error("An error occurred while starting a lbry file: %s", err.getErrorMessage())
log.error(rowid) log.debug(rowid)
log.error(stream_hash) log.debug(stream_hash)
log.error(options) log.debug(options)
def start_lbry_files(lbry_files_and_options): def start_lbry_files(lbry_files_and_options):
for rowid, stream_hash, options in lbry_files_and_options: for rowid, stream_hash, options in lbry_files_and_options: