Spaces:
Build error
Build error
msIntui commited on
Commit ·
d3ea93c
1
Parent(s): dec92fd
Add centralized logging configuration
Browse files- detectors.py +3 -7
- line_detection_ai.py +3 -7
- logger.py +11 -0
detectors.py
CHANGED
|
@@ -3,19 +3,15 @@ import os
|
|
| 3 |
import math
|
| 4 |
import json
|
| 5 |
import uuid
|
| 6 |
-
import logging
|
| 7 |
from abc import ABC, abstractmethod
|
| 8 |
from dataclasses import replace
|
| 9 |
from math import sqrt
|
| 10 |
from pathlib import Path
|
| 11 |
from typing import List, Optional, Tuple, Dict, Any
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
format='%(asctime)s - %(levelname)s - %(message)s'
|
| 17 |
-
)
|
| 18 |
-
logger = logging.getLogger(__name__)
|
| 19 |
|
| 20 |
# Third-party imports
|
| 21 |
import cv2
|
|
|
|
| 3 |
import math
|
| 4 |
import json
|
| 5 |
import uuid
|
|
|
|
| 6 |
from abc import ABC, abstractmethod
|
| 7 |
from dataclasses import replace
|
| 8 |
from math import sqrt
|
| 9 |
from pathlib import Path
|
| 10 |
from typing import List, Optional, Tuple, Dict, Any
|
| 11 |
|
| 12 |
+
# Get logger before any other imports
|
| 13 |
+
from logger import get_logger
|
| 14 |
+
logger = get_logger(__name__)
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Third-party imports
|
| 17 |
import cv2
|
line_detection_ai.py
CHANGED
|
@@ -1,14 +1,10 @@
|
|
| 1 |
# Standard library imports first
|
| 2 |
import os
|
| 3 |
-
import logging
|
| 4 |
from typing import List, Dict, Optional, Any
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
format='%(asctime)s - %(levelname)s - %(message)s'
|
| 10 |
-
)
|
| 11 |
-
logger = logging.getLogger(__name__)
|
| 12 |
|
| 13 |
# Third-party imports
|
| 14 |
import cv2
|
|
|
|
| 1 |
# Standard library imports first
|
| 2 |
import os
|
|
|
|
| 3 |
from typing import List, Dict, Optional, Any
|
| 4 |
|
| 5 |
+
# Get logger before any other imports
|
| 6 |
+
from logger import get_logger
|
| 7 |
+
logger = get_logger(__name__)
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Third-party imports
|
| 10 |
import cv2
|
logger.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
|
| 3 |
+
# Configure logging
|
| 4 |
+
logging.basicConfig(
|
| 5 |
+
level=logging.INFO,
|
| 6 |
+
format='%(asctime)s - %(levelname)s - %(message)s'
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
def get_logger(name):
|
| 10 |
+
"""Get a logger with the given name"""
|
| 11 |
+
return logging.getLogger(name)
|