Skip to content

Commit

Permalink
feat: Logging service
Browse files Browse the repository at this point in the history
- Centralises logging config
  • Loading branch information
alexhambley committed Jan 7, 2025
1 parent 028d81b commit ac33e38
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
19 changes: 19 additions & 0 deletions app/services/logging_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Logging service for the application."""

# Author: Alexander Hambley
# License: MIT
# Copyright (c) 2025 eScience Lab, The University of Manchester

import logging


def setup_logging(level: int = logging.INFO) -> None:
"""
Configure the logging for the application.
:param level: The logging level to set. Defaults to INFO.
"""
logging.basicConfig(
level=level,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
11 changes: 10 additions & 1 deletion cratey.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""Entry point for the Flask application."""

# Author: Alexander Hambley
# License: MIT
# Copyright (c) 2025 eScience Lab, The University of Manchester

from app import create_app
from app.services.logging_service import setup_logging

app, _ = create_app()
app = create_app()
setup_logging()

if __name__ == "__main__":
# Run the Flask development server:
app.run(host="0.0.0.0", debug=True)

0 comments on commit ac33e38

Please sign in to comment.