getsentry / getsentry/sentry-python

Implement f-string parsing

未关闭
#4,156 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Feature Logs Python
主要语言
Python
星标
2.2k
派生
669
平均合并
1 天 1 小时
30 天内合并 PR
213

描述

Currently the logs API is like this:
```python
my_local_var=123
sentry_logging.warn("This is the value {val}", val=my_local_var)
```

This is very similar to Python f-string format, but not exactly the same. We also want to make this work in Sentry logging:

```python
my_local_var=123
sentry_logging.warn(f"This is the value {my_local_var}")
```

I we want to parse variables from f-strings here is how other libs do this:
- Take the frame https://github.com/pydantic/logfire/blob/d5243c3a17efe10a63206eada209c1c6105474be/logfire/_internal/main.py#L183
- And then uses `ast` to parse the f-string: https://github.com/pydantic/logfire/blob/d5243c3a17efe10a63206eada209c1c6105474be/logfire/_internal/formatter.py#L63

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。