I attempt to organize the manner in which my Python logging formatter yields strings. I composed a moderate guide to show the issue:
import logging
from pathlib import Path
# create auxiliary variables
loggerName = Path(__file__).stem
# create logging formatter
logFormatter = logging.Formatter(fmt=' %(name)s :: %(levelname)s :: %(message)s')
# create logger
logger = logging.getLogger(loggerName)
logger.setLevel(logging.DEBUG)
# create console handler
consoleHandler = logging.StreamHandler()
consoleHandler.setLevel(logging.WARNING)
consoleHandler.setFormatter(logFormatter)
# Add console handler to logger
logger.addHandler(consoleHandler)
# Test
logger.debug('debug message')
logger.info('info message')
logger.warning('warn message')
logger.error('error message')
logger.critical('critical message')
logger :: WARNING :: warn message
logger :: ERROR :: error message
logger :: CRITICAL :: critical message
I might want to change the organizing to keep left half of my signing all together:
logger :: WARNING :: warn message
logger :: ERROR :: error message
logger :: CRITICAL :: critical message