Berickson/logging#241
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| protocol_log_filename = "{timestamp}-{user:-<15}-{remote:-<15}-{counter:0>10}-{pid}.dashboard".format( | ||
| timestamp=datetime.datetime.utcnow().isoformat(), | ||
| user=(user_context.get('user_id') or 'UNKNOWN')[:15], |
There was a problem hiding this comment.
Slice user identifier after converting to string
The log filename uses (user_context.get('user_id') or 'UNKNOWN')[:15] to truncate the user identifier before writing a dashboard log. user_id comes from the session and is often an integer, so attempting to slice it raises TypeError: 'int' object is not subscriptable and aborts the websocket handler before any work is done. Convert the identifier to str() (and likewise any other non‑string values) before truncating so integer IDs don’t crash the handler.
Useful? React with 👍 / 👎.
|
@codex address adding more comments to our changes |
|
Summary
Testing
|
No description provided.