Logging集成Sentry

导入名称:sentry_sdk.integrations.logging.LoggingIntegration

调用sentry_sdk.init()已经与日志记录模块集成。它等同于这种显式配置:

import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

sentry_logging = LoggingIntegration(
    level=logging.INFO,        # Capture info and above as breadcrumbs
    event_level=logging.ERROR  # Send no events from log messages
)
sentry_sdk.init(
    dsn="https://<key>@sentry.io/<project>",
    integrations=[sentry_logging]
)

如果要为日志记录发送事件,请将event_level设置为日志级别。

一、配置

level(默认INFO):级别高于或等于level的日志记录将被记录为breadcrumbs。任何低于此级别的日志记录都将被完全忽略。

event_level(默认错误):级别高于或等于event_level的日志记录将另外报告为事件。值为None表示不会将任何日志记录作为事件发送。 

猜你喜欢

转载自blog.csdn.net/u013702678/article/details/83213256