JAGPREET SINGH commited on
Commit
11acf19
1 Parent(s): 1593f66

looging and exception

Browse files
logs/08_30_2023_03_05_19.log/08_30_2023_03_05_19.log ADDED
File without changes
logs/08_30_2023_03_06_26.log/08_30_2023_03_06_26.log ADDED
@@ -0,0 +1 @@
 
 
1
+ [ 2023-08-30 03:06:26,500 ] 20 root - INFO - logging started
src/components/__init__.py ADDED
File without changes
src/components/data_ingestion.py ADDED
File without changes
src/components/data_transformation.py ADDED
File without changes
src/components/model_trainer.py ADDED
File without changes
src/exception.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import logging
3
+
4
+ def error_message_detail(error, error_detail:sys):
5
+ _,_,exc_tb = error_detail.exc_info()
6
+ filename = exc_tb.tb_frame.f_code.co_filename
7
+ error_message = "Error occured in script name [{0}] line number [{1}] error message [{2}]" \
8
+ .format(filename,exc_tb.tb_lineno,str(error))
9
+
10
+ return error_message
11
+
12
+
13
+ class CustomException(Exception):
14
+ def __init__(self, error_message, error_detail:sys):
15
+ super().__init__(error_message)
16
+ self.error_message = error_message_detail(error_message, error_detail=error_detail)
17
+
18
+ def __str__(self) -> str:
19
+ return self.error_message
20
+
src/logger.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import os
3
+ from datetime import datetime
4
+
5
+ LOG_FILE = f"{datetime.now().strftime('%m_%d_%Y_%H_%M_%S')}.log"
6
+ logs_path = os.path.join(os.getcwd(),"logs",LOG_FILE)
7
+ os.makedirs(logs_path,exist_ok=True)
8
+
9
+ LOG_FILE_PATH = os.path.join(logs_path,LOG_FILE)
10
+
11
+ logging.basicConfig(
12
+ filename=LOG_FILE_PATH,
13
+ format="[ %(asctime)s ] %(lineno)d %(name)s - %(levelname)s - %(message)s ",
14
+ level=logging.INFO
15
+
16
+ )
17
+
18
+
src/pipeline/__init__.py ADDED
File without changes
src/pipeline/predict_pipeline.py ADDED
File without changes
src/pipeline/train_pipeline.py ADDED
File without changes
src/utils.py ADDED
File without changes