moved debug.log file to the config directory

This commit is contained in:
Jonathan Warren 2013-07-14 16:12:59 -04:00
parent d93d923364
commit 1bf39dbfd0
3 changed files with 12 additions and 11 deletions

View File

@ -32,7 +32,6 @@ from class_singleListener import *
from class_addressGenerator import * from class_addressGenerator import *
# Helper Functions # Helper Functions
import helper_startup
import helper_bootstrap import helper_bootstrap
import sys import sys
@ -719,8 +718,6 @@ if __name__ == "__main__":
signal.signal(signal.SIGINT, helper_generic.signal_handler) signal.signal(signal.SIGINT, helper_generic.signal_handler)
# signal.signal(signal.SIGINT, signal.SIG_DFL) # signal.signal(signal.SIGINT, signal.SIG_DFL)
helper_startup.loadConfig()
helper_bootstrap.knownNodes() helper_bootstrap.knownNodes()
helper_bootstrap.dns() helper_bootstrap.dns()

View File

@ -18,6 +18,7 @@ Use: `from debug import logger` to import this facility into whatever module you
''' '''
import logging import logging
import logging.config import logging.config
import shared
# TODO(xj9): Get from a config file. # TODO(xj9): Get from a config file.
log_level = 'DEBUG' log_level = 'DEBUG'
@ -40,9 +41,9 @@ logging.config.dictConfig({
'class': 'logging.handlers.RotatingFileHandler', 'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default', 'formatter': 'default',
'level': log_level, 'level': log_level,
'filename': 'bm.log', 'filename': shared.appdata + 'debug.log',
'maxBytes': 1024, 'maxBytes': 2097152, # 2 MiB
'backupCount': 0, 'backupCount': 1,
} }
}, },
'loggers': { 'loggers': {
@ -65,4 +66,5 @@ logging.config.dictConfig({
}, },
}) })
# TODO (xj9): Get from a config file. # TODO (xj9): Get from a config file.
logger = logging.getLogger('console_only') #logger = logging.getLogger('console_only')
logger = logging.getLogger('both')

View File

@ -21,7 +21,8 @@ import socket
import random import random
import highlevelcrypto import highlevelcrypto
import shared import shared
from debug import logger import helper_startup
config = ConfigParser.SafeConfigParser() config = ConfigParser.SafeConfigParser()
myECCryptorObjects = {} myECCryptorObjects = {}
@ -63,8 +64,6 @@ ackdataForWhichImWatching = {}
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work. networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
networkDefaultPayloadLengthExtraBytes = 14000 #To make sending short messages a little more difficult, this value is added to the payload length for use in calculating the proof of work target. networkDefaultPayloadLengthExtraBytes = 14000 #To make sending short messages a little more difficult, this value is added to the payload length for use in calculating the proof of work target.
def isInSqlInventory(hash): def isInSqlInventory(hash):
t = (hash,) t = (hash,)
shared.sqlLock.acquire() shared.sqlLock.acquire()
@ -306,3 +305,6 @@ def fixPotentiallyInvalidUTF8Data(text):
except: except:
output = 'Part of the message is corrupt. The message cannot be displayed the normal way.\n\n' + repr(text) output = 'Part of the message is corrupt. The message cannot be displayed the normal way.\n\n' + repr(text)
return output return output
helper_startup.loadConfig()
from debug import logger