-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging_config.py
More file actions
28 lines (22 loc) · 980 Bytes
/
Copy pathlogging_config.py
File metadata and controls
28 lines (22 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File: logging_config.py
# Step 1: Logging Configuration
# Define a centralized logger
import logging
# Custom filter to suppress the specific warning
class SuppressCategoricalWarningFilter(logging.Filter):
def filter(self, record):
return "Using categorical units to plot a list of strings" not in record.getMessage()
# Prevent warnings from being captured by the logging system
logging.captureWarnings(False)
# Configure Logging
logging.basicConfig(level=logging.INFO,
format="%(asctime)s - %(levelname)s ->>> %(message)s",
handlers=[
logging.FileHandler("eda_pipeline.log"), # Save logs to a file
logging.StreamHandler() # Print logs to console
])
# Apply the filter to the root logger
root_logger = logging.getLogger()
root_logger.addFilter(SuppressCategoricalWarningFilter())
# Define the module-level logger
logger = logging.getLogger(__name__)