From 1bf39dbfd06102268f532ba54007251f7535b80a Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sun, 14 Jul 2013 16:12:59 -0400 Subject: [PATCH] moved debug.log file to the config directory --- src/bitmessagemain.py | 5 +---- src/debug.py | 10 ++++++---- src/shared.py | 8 +++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 4ffc9f5b..cfbfdd6c 100644 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -32,7 +32,6 @@ from class_singleListener import * from class_addressGenerator import * # Helper Functions -import helper_startup import helper_bootstrap import sys @@ -719,11 +718,9 @@ if __name__ == "__main__": signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) - helper_startup.loadConfig() - helper_bootstrap.knownNodes() helper_bootstrap.dns() - + # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left diff --git a/src/debug.py b/src/debug.py index 14214686..034d3102 100644 --- a/src/debug.py +++ b/src/debug.py @@ -18,6 +18,7 @@ Use: `from debug import logger` to import this facility into whatever module you ''' import logging import logging.config +import shared # TODO(xj9): Get from a config file. log_level = 'DEBUG' @@ -40,9 +41,9 @@ logging.config.dictConfig({ 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'default', 'level': log_level, - 'filename': 'bm.log', - 'maxBytes': 1024, - 'backupCount': 0, + 'filename': shared.appdata + 'debug.log', + 'maxBytes': 2097152, # 2 MiB + 'backupCount': 1, } }, 'loggers': { @@ -65,4 +66,5 @@ logging.config.dictConfig({ }, }) # TODO (xj9): Get from a config file. -logger = logging.getLogger('console_only') +#logger = logging.getLogger('console_only') +logger = logging.getLogger('both') diff --git a/src/shared.py b/src/shared.py index c706038a..5abeeb96 100644 --- a/src/shared.py +++ b/src/shared.py @@ -21,7 +21,8 @@ import socket import random import highlevelcrypto import shared -from debug import logger +import helper_startup + config = ConfigParser.SafeConfigParser() 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. 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): t = (hash,) shared.sqlLock.acquire() @@ -306,3 +305,6 @@ def fixPotentiallyInvalidUTF8Data(text): except: output = 'Part of the message is corrupt. The message cannot be displayed the normal way.\n\n' + repr(text) return output + +helper_startup.loadConfig() +from debug import logger \ No newline at end of file -- 2.45.1