24 lines
665 B
Python
24 lines
665 B
Python
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)
|