mirror of
https://github.com/vale981/dirkules
synced 2025-03-05 09:21:38 -05:00
added logging
This commit is contained in:
parent
899e42ebea
commit
2cbd6b3c10
3 changed files with 13 additions and 1 deletions
|
@ -9,6 +9,17 @@ app = Flask(__name__)
|
|||
app.config.from_object(config)
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
# Logging
|
||||
import logging
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
|
||||
log_level = app.config["LOG_LEVEL"]
|
||||
formatter = logging.Formatter("[%(asctime)s]: %(levelname)s in {%(pathname)s:%(lineno)d} - %(message)s")
|
||||
handler = TimedRotatingFileHandler("dirkules.log", when="D", interval=1, backupCount=90)
|
||||
handler.setLevel(log_level)
|
||||
handler.setFormatter(formatter)
|
||||
app.logger.addHandler(handler)
|
||||
|
||||
import dirkules.models
|
||||
|
||||
# create db if not exists
|
||||
|
|
|
@ -8,6 +8,8 @@ from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
|
|||
baseDir = os.path.abspath(os.path.dirname(__file__))
|
||||
staticDir = os.path.join(baseDir, 'static')
|
||||
|
||||
LOG_LEVEL = "DEBUG"
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(baseDir, 'dirkules.db')
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ import dirkules.manager.driveManager as drive_man
|
|||
|
||||
def refresh_disks():
|
||||
drive_man.get_drives()
|
||||
print("Drives haha refreshed")
|
||||
|
|
Loading…
Add table
Reference in a new issue