More details in how log entries are made

More details in how log entries are made: add in the filename & function which is logging something right before the line number
This commit is contained in:
barbequesauce 2018-03-08 14:59:29 -05:00 committed by evilhero
parent 131cbb3eae
commit 0442d808c9
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 :: %(lineno)s : %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
file_formatter = Formatter('%(asctime)s - %(levelname)-7s :: %(name)s.%(funcName)s.%(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 :: %(lineno)s : %(threadName)s : %(message)s', '%d-%b-%Y %H:%M:%S')
console_formatter = logging.Formatter('%(asctime)s - %(levelname)s :: %(name)s.%(funcName)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)