Hebaelsayed commited on
Commit
4b38ac0
·
verified ·
1 Parent(s): 8a9b0a1

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +43 -7
src/streamlit_app.py CHANGED
@@ -1,14 +1,50 @@
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  st.set_page_config(page_title="Math AI", layout="wide")
4
 
 
 
 
 
5
  st.title("🧮 Math AI System")
6
- st.markdown("### Step 1: Testing Basic Setup")
 
 
 
 
7
 
8
- st.success("✅ Your app is running!")
9
- st.write("If you see this, everything is working!")
 
 
 
10
 
11
- # Test user input
12
- name = st.text_input("What's your name?")
13
- if name:
14
- st.write(f"Hello, {name}! 👋")
 
 
 
 
 
1
  import streamlit as st
2
+ import logging
3
+ from pathlib import Path
4
+
5
+ # ============================================================================
6
+ # SETUP
7
+ # ============================================================================
8
+
9
+ # Create logs folder
10
+ LOGS_DIR = Path("logs")
11
+ LOGS_DIR.mkdir(exist_ok=True)
12
+
13
+ # Setup logging
14
+ logging.basicConfig(
15
+ level=logging.DEBUG,
16
+ format='%(asctime)s - %(levelname)s - %(message)s',
17
+ handlers=[
18
+ logging.FileHandler(LOGS_DIR / "app.log"),
19
+ logging.StreamHandler()
20
+ ]
21
+ )
22
+ logger = logging.getLogger(__name__)
23
 
24
  st.set_page_config(page_title="Math AI", layout="wide")
25
 
26
+ # ============================================================================
27
+ # STEP 1: BASIC LOGGING TEST
28
+ # ============================================================================
29
+
30
  st.title("🧮 Math AI System")
31
+ st.markdown("### Step 1: Logging System")
32
+
33
+ logger.info("App loaded successfully")
34
+
35
+ st.success("✅ Logging is working!")
36
 
37
+ # Test logging
38
+ if st.button("Click to test logger"):
39
+ logger.debug("User clicked the button")
40
+ logger.info("This is an info message")
41
+ st.write("Check logs below ↓")
42
 
43
+ # Show logs
44
+ if st.checkbox("Show logs"):
45
+ log_file = LOGS_DIR / "app.log"
46
+ if log_file.exists():
47
+ with open(log_file, 'r') as f:
48
+ st.code(f.read())
49
+ else:
50
+ st.info("No logs yet")