Skip to content

Commit cb2f89a

Browse files
author
Jonathan Warren
committed
Merge pull request #300 from Atheros1/master
Move debug.log to the config directory
2 parents d93d923 + 1bf39db commit cb2f89a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/bitmessagemain.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from class_addressGenerator import *
3333

3434
# Helper Functions
35-
import helper_startup
3635
import helper_bootstrap
3736

3837
import sys
@@ -719,11 +718,9 @@ def run(self):
719718
signal.signal(signal.SIGINT, helper_generic.signal_handler)
720719
# signal.signal(signal.SIGINT, signal.SIG_DFL)
721720

722-
helper_startup.loadConfig()
723-
724721
helper_bootstrap.knownNodes()
725722
helper_bootstrap.dns()
726-
723+
727724
# Start the address generation thread
728725
addressGeneratorThread = addressGenerator()
729726
addressGeneratorThread.daemon = True # close the main program even if there are threads left

src/debug.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'''
1919
import logging
2020
import logging.config
21+
import shared
2122

2223
# TODO(xj9): Get from a config file.
2324
log_level = 'DEBUG'
@@ -40,9 +41,9 @@
4041
'class': 'logging.handlers.RotatingFileHandler',
4142
'formatter': 'default',
4243
'level': log_level,
43-
'filename': 'bm.log',
44-
'maxBytes': 1024,
45-
'backupCount': 0,
44+
'filename': shared.appdata + 'debug.log',
45+
'maxBytes': 2097152, # 2 MiB
46+
'backupCount': 1,
4647
}
4748
},
4849
'loggers': {
@@ -65,4 +66,5 @@
6566
},
6667
})
6768
# TODO (xj9): Get from a config file.
68-
logger = logging.getLogger('console_only')
69+
#logger = logging.getLogger('console_only')
70+
logger = logging.getLogger('both')

src/shared.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import random
2222
import highlevelcrypto
2323
import shared
24-
from debug import logger
24+
import helper_startup
25+
2526

2627
config = ConfigParser.SafeConfigParser()
2728
myECCryptorObjects = {}
@@ -63,8 +64,6 @@
6364
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
6465
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.
6566

66-
67-
6867
def isInSqlInventory(hash):
6968
t = (hash,)
7069
shared.sqlLock.acquire()
@@ -306,3 +305,6 @@ def fixPotentiallyInvalidUTF8Data(text):
306305
except:
307306
output = 'Part of the message is corrupt. The message cannot be displayed the normal way.\n\n' + repr(text)
308307
return output
308+
309+
helper_startup.loadConfig()
310+
from debug import logger

0 commit comments

Comments
 (0)