justKevv commited on
Commit
6fadde3
·
1 Parent(s): dc3fd68

fix(app); fixing the logging to find out the duplication

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -6,6 +6,14 @@ import warnings
6
  from sklearn.exceptions import InconsistentVersionWarning
7
  from contextlib import asynccontextmanager
8
 
 
 
 
 
 
 
 
 
9
  logger = logging.getLogger(__name__)
10
  warnings.filterwarnings('ignore', category=InconsistentVersionWarning)
11
  logging.getLogger('absl').setLevel(logging.ERROR)
@@ -34,8 +42,11 @@ def greet_json():
34
  @app.get("/predict-machine")
35
  def predict_machine():
36
  logger.info("Prediction request received")
 
 
37
 
38
  sensor = database.get_sensor_readings()
 
39
 
40
  if sensor is None:
41
  logging.warning("No sensor data available")
 
6
  from sklearn.exceptions import InconsistentVersionWarning
7
  from contextlib import asynccontextmanager
8
 
9
+ logging.basicConfig(
10
+ level=logging.INFO,
11
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
12
+ handlers=[
13
+ logging.StreamHandler(sys.stdout)
14
+ ]
15
+ )
16
+
17
  logger = logging.getLogger(__name__)
18
  warnings.filterwarnings('ignore', category=InconsistentVersionWarning)
19
  logging.getLogger('absl').setLevel(logging.ERROR)
 
42
  @app.get("/predict-machine")
43
  def predict_machine():
44
  logger.info("Prediction request received")
45
+ logger.info(f"Controller instance ID: {id(controller)}")
46
+ logger.info(f"Database instance ID: {id(database)}")
47
 
48
  sensor = database.get_sensor_readings()
49
+ logger.info(f"Retrieved sensor: {sensor}")
50
 
51
  if sensor is None:
52
  logging.warning("No sensor data available")