JUNGU commited on
Commit
8d34983
·
verified ·
1 Parent(s): a61c48c

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +19 -4
src/streamlit_app.py CHANGED
@@ -1046,15 +1046,30 @@ elif menu == "뉴스 기사 예약하기":
1046
  with tab3:
1047
  st.subheader("스케줄러 제어 및 상태")
1048
 
1049
- # 로그 뷰어 추가
1050
- if st.checkbox("로그 보기"):
 
 
 
1051
  try:
1052
  with open('/tmp/crawler.log', 'r') as f:
1053
  logs = f.readlines()
1054
- st.text_area("최근 로그", value=''.join(logs[-100:]), height=400)
1055
  except Exception as e:
1056
- st.error(f"로그 파일을 읽을 수 없습니다: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
1057
 
 
1058
  col1, col2 = st.columns(2)
1059
 
1060
  with col1:
 
1046
  with tab3:
1047
  st.subheader("스케줄러 제어 및 상태")
1048
 
1049
+ # 로그 뷰어를 상단에 배치
1050
+ st.subheader("실시간 로그")
1051
+ log_container = st.empty()
1052
+
1053
+ def update_logs():
1054
  try:
1055
  with open('/tmp/crawler.log', 'r') as f:
1056
  logs = f.readlines()
1057
+ return ''.join(logs[-100:]) # 최근 100줄만 표시
1058
  except Exception as e:
1059
+ return f"로그 파일을 읽을 수 없습니다: {str(e)}"
1060
+
1061
+ # 로그 자동 업데이트
1062
+ if st.checkbox("로그 자동 업데이트", value=True):
1063
+ log_content = update_logs()
1064
+ log_container.text_area("최근 로그", value=log_content, height=400)
1065
+ else:
1066
+ if st.button("로그 새로고침"):
1067
+ log_content = update_logs()
1068
+ log_container.text_area("최근 로그", value=log_content, height=400)
1069
+
1070
+ st.divider()
1071
 
1072
+ # 스케줄러 제어
1073
  col1, col2 = st.columns(2)
1074
 
1075
  with col1: