Skip to content

Commit cd36c3b

Browse files
rework logging and get_root_logger
1 parent c6a8145 commit cd36c3b

23 files changed

+68
-47
lines changed

app/api/audio.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22

33
from bson import ObjectId
44
from flask import Blueprint
@@ -9,7 +9,8 @@
99
from app.utils import check_arguments_are_convertible_to_object_id
1010

1111
api_audio = Blueprint('api_audio', __name__)
12-
logger = logging.getLogger('root_logger')
12+
logger = get_root_logger()
13+
1314

1415

1516
@check_arguments_are_convertible_to_object_id

app/api/criteria.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from bson import ObjectId
22
from flask import Blueprint, request
3-
import logging
43
from json import dumps
54

65
from app.check_access import check_access

app/api/dump.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Blueprint, send_file
22
from datetime import datetime
3-
import logging
3+
from app.root_logger import get_root_logger
44
import os
55
import subprocess
66
from werkzeug.utils import secure_filename
@@ -10,7 +10,8 @@
1010

1111

1212
api_dump = Blueprint('api_dump', __name__)
13-
logger = logging.getLogger('root_logger')
13+
logger = get_root_logger()
14+
1415

1516
backup_filenames = ('backup.zip', 'backup_nochunks.zip')
1617

app/api/files.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22

33
from bson import ObjectId
44
from flask import Blueprint, make_response, request, send_file, session
@@ -11,7 +11,8 @@
1111
check_arguments_are_convertible_to_object_id, convert_to_pdf, is_convertible
1212

1313
api_files = Blueprint('api_files', __name__)
14-
logger = logging.getLogger('root_logger')
14+
logger = get_root_logger()
15+
1516

1617
@check_arguments_are_convertible_to_object_id
1718
@api_files.route('/api/files/presentation-records/<presentation_record_file_id>/', methods=['GET'])

app/api/logs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import datetime
2-
import logging
2+
from app.root_logger import get_root_logger
33
from ast import literal_eval
44

55
from flask import Blueprint, request
@@ -8,7 +8,8 @@
88
from app.mongo_odm import LogsDBManager
99

1010
api_logs = Blueprint('api_logs', __name__)
11-
logger = logging.getLogger('root_logger')
11+
logger = get_root_logger()
12+
1213

1314

1415
@api_logs.route('/api/logs/', methods=['GET'])

app/api/presentations.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22

33
from flask import Blueprint
44

@@ -8,7 +8,8 @@
88
from app.utils import check_arguments_are_convertible_to_object_id
99

1010
api_presentations = Blueprint('api_presentations', __name__)
11-
logger = logging.getLogger('root_logger')
11+
logger = get_root_logger()
12+
1213

1314

1415
def get_presentation_information(current_presentation_file: PresentationFiles) -> dict:

app/api/sessions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22

33
from flask import Blueprint, request, session
44

@@ -9,7 +9,8 @@
99
from ua_parser.user_agent_parser import Parse as user_agent_parse
1010

1111
api_sessions = Blueprint('api_sessions', __name__)
12-
logger = logging.getLogger('root_logger')
12+
logger = get_root_logger()
13+
1314

1415

1516
@api_sessions.route('/api/sessions/info/', methods=['GET'])

app/api/task_attempts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22

33
from bson import ObjectId
44
from flask import session, request, Blueprint
@@ -9,7 +9,8 @@
99
from app.utils import check_arguments_are_convertible_to_object_id, check_argument_is_convertible_to_object_id
1010

1111
api_task_attempts = Blueprint('api_task_attempts', __name__)
12-
logger = logging.getLogger('root_logger')
12+
logger = get_root_logger()
13+
1314

1415

1516
@check_arguments_are_convertible_to_object_id

app/api/trainings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22
import time
33
import json
44
import os
@@ -20,7 +20,8 @@
2020
from app.localisation import *
2121

2222
api_trainings = Blueprint('api_trainings', __name__)
23-
logger = logging.getLogger('root_logger')
23+
logger = get_root_logger()
24+
2425

2526

2627
@check_arguments_are_convertible_to_object_id

app/api/version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging
1+
from app.root_logger import get_root_logger
22
from flask import render_template, Blueprint
33
from app.lti_session_passback.auth_checkers import check_admin
44
import os
@@ -7,7 +7,8 @@
77
from app.config import Config
88

99
api_version = Blueprint('api_version', __name__)
10-
logger = logging.getLogger('root_logger')
10+
logger = get_root_logger()
11+
1112

1213

1314
@api_version.route('/api/version/info/', methods=['GET'])

0 commit comments

Comments
 (0)