yakilee Claude Opus 4.6 commited on
Commit
9edb6c6
·
1 Parent(s): cd8cf7c

fix(logging): configure stdlib logging and structlog integration

Browse files

- Add stdlib logging.basicConfig before structlog setup
- Switch structlog to stdlib-backed logger factory
- Fix import ordering in state_manager

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. app/services/state_manager.py +1 -1
  2. streamlit_app.py +15 -3
app/services/state_manager.py CHANGED
@@ -1,7 +1,7 @@
1
  """Session state orchestration for TrialPath Streamlit app."""
2
 
3
- import structlog
4
  import streamlit as st
 
5
 
6
  logger = structlog.get_logger("trialpath.journey")
7
 
 
1
  """Session state orchestration for TrialPath Streamlit app."""
2
 
 
3
  import streamlit as st
4
+ import structlog
5
 
6
  logger = structlog.get_logger("trialpath.journey")
7
 
streamlit_app.py CHANGED
@@ -3,23 +3,35 @@
3
  Entrypoint: multipage Streamlit app with st.navigation.
4
  """
5
 
 
 
 
6
  from dotenv import load_dotenv
7
 
8
  load_dotenv()
9
 
 
 
 
 
 
 
 
 
10
  import structlog # noqa: E402
11
 
12
  structlog.configure(
13
  processors=[
 
 
14
  structlog.processors.TimeStamper(fmt="iso"),
15
- structlog.processors.add_log_level,
16
  structlog.processors.StackInfoRenderer(),
17
  structlog.processors.format_exc_info,
18
  structlog.processors.JSONRenderer(),
19
  ],
20
- wrapper_class=structlog.BoundLogger,
21
  context_class=dict,
22
- logger_factory=structlog.PrintLoggerFactory(),
23
  cache_logger_on_first_use=True,
24
  )
25
 
 
3
  Entrypoint: multipage Streamlit app with st.navigation.
4
  """
5
 
6
+ import logging # noqa: E402
7
+ import sys # noqa: E402
8
+
9
  from dotenv import load_dotenv
10
 
11
  load_dotenv()
12
 
13
+ # Configure stdlib logging FIRST so all loggers (pipeline, services) are captured
14
+ logging.basicConfig(
15
+ level=logging.INFO,
16
+ format="%(asctime)s %(levelname)s %(name)s: %(message)s",
17
+ stream=sys.stderr,
18
+ force=True,
19
+ )
20
+
21
  import structlog # noqa: E402
22
 
23
  structlog.configure(
24
  processors=[
25
+ structlog.stdlib.add_log_level,
26
+ structlog.stdlib.add_logger_name,
27
  structlog.processors.TimeStamper(fmt="iso"),
 
28
  structlog.processors.StackInfoRenderer(),
29
  structlog.processors.format_exc_info,
30
  structlog.processors.JSONRenderer(),
31
  ],
32
+ wrapper_class=structlog.stdlib.BoundLogger,
33
  context_class=dict,
34
+ logger_factory=structlog.stdlib.LoggerFactory(),
35
  cache_logger_on_first_use=True,
36
  )
37