Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日志记录器对象 stacklevel 定位有时不准确 #5

Open
2018-11-27 opened this issue Jul 16, 2024 · 3 comments
Open

日志记录器对象 stacklevel 定位有时不准确 #5

2018-11-27 opened this issue Jul 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@2018-11-27
Copy link
Member

当配合使用 TryExeptRetry 并传入了日志记录器对象时,后者的 stacklevel 定位总是不准确。

@2018-11-27 2018-11-27 self-assigned this Jul 17, 2024
@2018-11-27 2018-11-27 added the bug Something isn't working label Jul 17, 2024
@2018-11-27
Copy link
Member Author

同样的问题出现在 __traceback__

[2024-07-17 10:23:15] [try:1/3:1] [__main__.func.line12.ValueError] invalid literal for int() with base 10: 'a'
[2024-07-17 10:23:16] [try:2/3:1] [__main__.func.line12.ValueError] invalid literal for int() with base 10: 'a'
[2024-07-17 10:23:17] [try:3/3:1] [__main__.func.line12.ValueError] invalid literal for int() with base 10: 'a'
[2024-07-17 10:23:17] [__main__.TryExcept.__call__.<locals>.inner.line236.ValueError] invalid literal for int() with base 10: 'a'

2018-11-27 added a commit to 2018-11-27/exceptionx that referenced this issue Jul 22, 2024
1.`TryExcept` and `TryContext` now support handling exceptions based on exception message strings and have added the functionality to negate exception types.
2.Both `@Retry` and `@Retry()` are now supported as valid syntax, as well as `TryExcept`.
3.Fixed an issue: The retry counter in `Retry` incorrectly started from zero. gqylpy#4
4.Fixed an issue: The `stacklevel` positioning of the logger object was sometimes inaccurate. gqylpy#5
5.Optimized exception output for `Retry`, adding display for `limit_time` and `event`.
6.Fixed a serious issue in `Retry` where exception information might be "spammed" output.
7.Added type checking for the parameter `etype`.
8.The internal default value for retry events has been changed to `None`.
9.Updated annotations, comments, and documentation files for the above changes.

1.`TryExcept` 和 `TryContext` 现在支持按异常消息字符串处理异常,并新增了异常类型取反的功能。
2.同时支持 `@Retry` 和 `@Retry()` 作为有效语法,亦 `TryExcept`。
3.修复问题:`Retry` 中重试计数器错误地从零开始。 gqylpy#4
4.修复问题:日志记录器对象 `stacklevel` 定位有时不准确。 gqylpy#5
5.优化了 `Retry` 的异常输出,增加了对 `limit_time` 和 `event` 显示。
6.修复了 `Retry` 中可能会 “疯狂输出” 异常信息的严重问题。
7.添加对参数 `etype` 的类型校验。
8.重试事件的内部默认值修改为 `None`。
9.针对以上改动更新注解,注释及自述文件。
@2018-11-27 2018-11-27 mentioned this issue Jul 22, 2024
Merged
@2018-11-27
Copy link
Member Author

后者 __traceback__ 定位不准的问题已得到修复 #6,版本 4.1

@2018-11-27
Copy link
Member Author

stacklevel 定位不准的问题,目前对相关的代码段进行了优化,但仍未找到有效解决方案,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant