Initial commit

This commit is contained in:
2022-06-29 09:00:03 -04:00
commit 9cdb918098
6 changed files with 239 additions and 0 deletions

23
app_log.py Normal file
View File

@@ -0,0 +1,23 @@
import logging
import os
import configparser
import find_ini
# Global variables that should maintain consistency across all logging activities.
option_file = find_ini.find_ini()
simple_blog_conf = configparser.ConfigParser()
simple_blog_conf.read(option_file)
if simple_blog_conf['general']['log_file'] != '':
log_file = simple_blog_conf['general']['log_file']
else:
log_file = os.path.dirname(os.path.realpath(__file__)) + '/.simple-blog.log'
logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s', filename=log_file, level=logging.INFO)
def info(log_text):
logging.info(log_text)
def warning(log_text):
logging.warning(log_text)