nikhil-xyz
commited on
Commit
•
86c3c59
1
Parent(s):
c73a8e2
logging module added
Browse files- .gitignore +2 -0
- main.py +3 -0
- src/insurancePP/logging/__init__.py +19 -0
.gitignore
CHANGED
@@ -158,3 +158,5 @@ cython_debug/
|
|
158 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160 |
#.idea/
|
|
|
|
|
|
158 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160 |
#.idea/
|
161 |
+
|
162 |
+
artifacts/*
|
main.py
CHANGED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from insurancePP.logging import logger
|
2 |
+
|
3 |
+
logger.info("logging is activated")
|
src/insurancePP/logging/__init__.py
CHANGED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import logging
|
4 |
+
|
5 |
+
logging_str = "[%(asctime)s : %(levelname)s : %(module)s : %(message)s]"
|
6 |
+
log_dir = "logs"
|
7 |
+
log_filepath = os.path.join(log_dir, "running_logs.log")
|
8 |
+
os.makedirs(log_dir, exist_ok=True)
|
9 |
+
|
10 |
+
logging.basicConfig(
|
11 |
+
level = logging.INFO,
|
12 |
+
format = logging_str,
|
13 |
+
handlers = [
|
14 |
+
logging.FileHandler(log_filepath),
|
15 |
+
logging.StreamHandler(sys.stdout)
|
16 |
+
]
|
17 |
+
)
|
18 |
+
|
19 |
+
logger = logging.getLogger("ippLogger")
|