Merge pull request #440 from Atheros1/master
Swap print statements for logging statements
This commit is contained in:
commit
0c2ce666c2
|
@ -42,6 +42,17 @@ from class_addressGenerator import *
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
import helper_bootstrap
|
import helper_bootstrap
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
from debug import logger
|
||||||
|
|
||||||
|
import sys
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
if float("{1}.{2}".format(*sys.version_info)) < 7.5:
|
||||||
|
logger.critical("You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info))
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
>>>>>>> 53ca5b03ffb6b35ac03588107dc4a1d5cde7aad4
|
||||||
def connectToStream(streamNumber):
|
def connectToStream(streamNumber):
|
||||||
selfInitiatedConnections[streamNumber] = {}
|
selfInitiatedConnections[streamNumber] = {}
|
||||||
if sys.platform[0:3] == 'win':
|
if sys.platform[0:3] == 'win':
|
||||||
|
@ -127,7 +138,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
print 'Authentication failed because header lacks Authentication field'
|
logger.warn('Authentication failed because header lacks Authentication field')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -277,7 +288,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
if numberOfAddresses > 999:
|
if numberOfAddresses > 999:
|
||||||
return 'API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.'
|
return 'API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.'
|
||||||
shared.apiAddressGeneratorReturnQueue.queue.clear()
|
shared.apiAddressGeneratorReturnQueue.queue.clear()
|
||||||
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.'
|
logger.debug('Requesting that the addressGenerator create %s addresses.', numberOfAddresses)
|
||||||
shared.addressGeneratorQueue.put(
|
shared.addressGeneratorQueue.put(
|
||||||
('createDeterministicAddresses', addressVersionNumber, streamNumber,
|
('createDeterministicAddresses', addressVersionNumber, streamNumber,
|
||||||
'unused API address', numberOfAddresses, passphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes))
|
'unused API address', numberOfAddresses, passphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes))
|
||||||
|
@ -303,7 +314,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
if streamNumber != 1:
|
if streamNumber != 1:
|
||||||
return 'API Error 0003: The stream number must be 1. Others aren\'t supported.'
|
return 'API Error 0003: The stream number must be 1. Others aren\'t supported.'
|
||||||
shared.apiAddressGeneratorReturnQueue.queue.clear()
|
shared.apiAddressGeneratorReturnQueue.queue.clear()
|
||||||
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.'
|
logger.debug('Requesting that the addressGenerator create %s addresses.', numberOfAddresses)
|
||||||
shared.addressGeneratorQueue.put(
|
shared.addressGeneratorQueue.put(
|
||||||
('getDeterministicAddress', addressVersionNumber,
|
('getDeterministicAddress', addressVersionNumber,
|
||||||
streamNumber, 'unused API address', numberOfAddresses, passphrase, eighteenByteRipe))
|
streamNumber, 'unused API address', numberOfAddresses, passphrase, eighteenByteRipe))
|
||||||
|
@ -516,8 +527,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
status, addressVersionNumber, streamNumber, toRipe = decodeAddress(
|
status, addressVersionNumber, streamNumber, toRipe = decodeAddress(
|
||||||
toAddress)
|
toAddress)
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
with shared.printLock:
|
logger.warn('API Error 0007: Could not decode address %s. Status: %s.', toAddress, status)
|
||||||
print 'API Error 0007: Could not decode address:', toAddress, ':', status
|
|
||||||
|
|
||||||
if status == 'checksumfailed':
|
if status == 'checksumfailed':
|
||||||
return 'API Error 0008: Checksum failed for address: ' + toAddress
|
return 'API Error 0008: Checksum failed for address: ' + toAddress
|
||||||
|
@ -533,8 +543,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
|
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
|
||||||
fromAddress)
|
fromAddress)
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
with shared.printLock:
|
logger.warn('API Error 0007: Could not decode address %s. Status: %s.', fromAddress, status)
|
||||||
print 'API Error 0007: Could not decode address:', fromAddress, ':', status
|
|
||||||
|
|
||||||
if status == 'checksumfailed':
|
if status == 'checksumfailed':
|
||||||
return 'API Error 0008: Checksum failed for address: ' + fromAddress
|
return 'API Error 0008: Checksum failed for address: ' + fromAddress
|
||||||
|
@ -598,8 +607,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
|
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
|
||||||
fromAddress)
|
fromAddress)
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
with shared.printLock:
|
logger.warn('API Error 0007: Could not decode address %s. Status: %s.', fromAddress, status)
|
||||||
print 'API Error 0007: Could not decode address:', fromAddress, ':', status
|
|
||||||
|
|
||||||
if status == 'checksumfailed':
|
if status == 'checksumfailed':
|
||||||
return 'API Error 0008: Checksum failed for address: ' + fromAddress
|
return 'API Error 0008: Checksum failed for address: ' + fromAddress
|
||||||
|
@ -669,8 +677,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
status, addressVersionNumber, streamNumber, toRipe = decodeAddress(
|
status, addressVersionNumber, streamNumber, toRipe = decodeAddress(
|
||||||
address)
|
address)
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
with shared.printLock:
|
logger.warn('API Error 0007: Could not decode address %s. Status: %s.', address, status)
|
||||||
print 'API Error 0007: Could not decode address:', address, ':', status
|
|
||||||
|
|
||||||
if status == 'checksumfailed':
|
if status == 'checksumfailed':
|
||||||
return 'API Error 0008: Checksum failed for address: ' + address
|
return 'API Error 0008: Checksum failed for address: ' + address
|
||||||
|
|
Reference in New Issue
Block a user