Added code line numbers to log formats

Added code line numbers to log formats to ease/speed up troubleshooting.
This commit is contained in:
barbequesauce 2018-03-08 14:09:06 -05:00 committed by evilhero
parent a8c2edf33a
commit 131cbb3eae
1 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ def initLogger(console=False, log_dir=False, init=False, verbose=False):
# Setup file logger
if log_dir:
filename = os.path.join(log_dir, FILENAME)
file_formatter = Formatter('%(asctime)s - %(levelname)-7s :: %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
file_formatter = Formatter('%(asctime)s - %(levelname)-7s :: %(lineno)s : %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
file_handler = RFHandler(filename, "a", maxBytes=max_size, backupCount=MAX_FILES)
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(file_formatter)
@ -126,7 +126,7 @@ def initLogger(console=False, log_dir=False, init=False, verbose=False):
# Setup console logger
if console:
console_formatter = logging.Formatter('%(asctime)s - %(levelname)s :: %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
console_formatter = logging.Formatter('%(asctime)s - %(levelname)s :: %(lineno)s : %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
console_handler = logging.StreamHandler()
console_handler.setFormatter(console_formatter)
console_handler.setLevel(logging.DEBUG)