mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 18:34:18 +00:00
Add simple logging
This commit is contained in:
parent
51d2623e2e
commit
230d057fee
2
app/logs/main.log
Normal file
2
app/logs/main.log
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
2019-09-11 12:48:21 - WARNING - werkzeug - _internal.py - 122 - * Debugger is active!
|
||||||
|
2019-09-11 12:48:21 - INFO - werkzeug - _internal.py - 122 - * Debugger PIN: 140-241-697
|
@ -4,8 +4,9 @@ from flask_login import current_user, login_required
|
|||||||
from . import main
|
from . import main
|
||||||
from .forms import CreateCorpusForm
|
from .forms import CreateCorpusForm
|
||||||
from .. import db
|
from .. import db
|
||||||
from ..models import Corpus
|
from ..models import Corpus, Job
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
@main.route('/')
|
@main.route('/')
|
||||||
@ -137,3 +138,13 @@ def job_download(job_id):
|
|||||||
return send_from_directory(as_attachment=True,
|
return send_from_directory(as_attachment=True,
|
||||||
directory=dir,
|
directory=dir,
|
||||||
filename=file)
|
filename=file)
|
||||||
|
|
||||||
|
|
||||||
|
@main.route('/jobs/<int:job_id>/delete')
|
||||||
|
@login_required
|
||||||
|
def delete_job(job_id):
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
job = Job.query.filter_by(id=job_id).first()
|
||||||
|
job.flag_for_stop()
|
||||||
|
logger.warning('Job status: {}'.format(job.status))
|
||||||
|
return redirect(url_for('main.dashboard'))
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@ -35,6 +36,11 @@ class DevelopmentConfig(Config):
|
|||||||
os.environ.get('POSTGRES_PASSWORD'),
|
os.environ.get('POSTGRES_PASSWORD'),
|
||||||
os.environ.get('POSTGRES_DB_NAME')
|
os.environ.get('POSTGRES_DB_NAME')
|
||||||
)
|
)
|
||||||
|
log_format = "%(asctime)s - %(levelname)s - %(name)s - "\
|
||||||
|
"%(filename)s - %(lineno)d - %(message)s"
|
||||||
|
logging.basicConfig(filename='app/logs/main.log', level='WARNING',
|
||||||
|
format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
|
||||||
|
filemode='w')
|
||||||
|
|
||||||
|
|
||||||
class TestingConfig(Config):
|
class TestingConfig(Config):
|
||||||
|
Loading…
Reference in New Issue
Block a user