Normalised capitalisation of log file

This commit is contained in:
jeancf 2022-12-11 12:01:32 +01:00
parent 920dcb4e6e
commit 6c11d39e6c

View File

@ -553,8 +553,8 @@ def terminate(exit_code):
max_delta = timedelta(TOML['options']['log_days']) max_delta = timedelta(TOML['options']['log_days'])
# Open log file # Open log file
log_file_name = TOML['config']['twitter_account'] + '.log' log_file_name = TOML['config']['twitter_account'].lower() + '.log'
new_log_file_name = TOML['config']['twitter_account'] + '.log.new' new_log_file_name = TOML['config']['twitter_account'].lower() + '.log.new'
try: try:
log_file = open(log_file_name, 'r') log_file = open(log_file_name, 'r')
except FileNotFoundError: except FileNotFoundError:
@ -624,7 +624,7 @@ def main(argv):
# Setup logging to file # Setup logging to file
logging.basicConfig( logging.basicConfig(
filename=TOML['config']['twitter_account'] + '.log', filename=TOML['config']['twitter_account'].lower() + '.log',
format='%(asctime)s %(levelname)-8s %(message)s', format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S', datefmt='%Y-%m-%d %H:%M:%S',
) )
@ -734,7 +734,7 @@ def main(argv):
# Make soup # Make soup
soup = BeautifulSoup(twit_account_page.text, 'html.parser') soup = BeautifulSoup(twit_account_page.text, 'html.parser')
# Replace twit_account with version with correct capitalization # Replace twitter_account with version with correct capitalization
ta = soup.find('meta', property='og:title').get('content') ta = soup.find('meta', property='og:title').get('content')
ta_match = re.search(r'\(@(.+)\)', ta) ta_match = re.search(r'\(@(.+)\)', ta)
if ta_match is not None: if ta_match is not None: