forked from 20xd6/simple_blog_cms
Initial commit
This commit is contained in:
23
app_log.py
Normal file
23
app_log.py
Normal 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)
|
||||
Reference in New Issue
Block a user