Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
230d057f
Commit
230d057f
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Add simple logging
parent
51d2623e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/logs/main.log
+2
-0
2 additions, 0 deletions
app/logs/main.log
app/main/views.py
+12
-1
12 additions, 1 deletion
app/main/views.py
config.py
+6
-0
6 additions, 0 deletions
config.py
with
20 additions
and
1 deletion
app/logs/main.log
0 → 100644
+
2
−
0
View file @
230d057f
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
This diff is collapsed.
Click to expand it.
app/main/views.py
+
12
−
1
View file @
230d057f
...
@@ -4,8 +4,9 @@ from flask_login import current_user, login_required
...
@@ -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):
...
@@ -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
'
))
This diff is collapsed.
Click to expand it.
config.py
+
6
−
0
View file @
230d057f
import
os
import
os
import
logging
class
Config
:
class
Config
:
...
@@ -35,6 +36,11 @@ class DevelopmentConfig(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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment