Skip to content

Commit 296b1bf

Browse files
authored
fix: Include logging docs in new API docs (getsentry#494)
1 parent f18e0df commit 296b1bf

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed

docs/api.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
========
2+
Main API
3+
========
4+
5+
.. inherited-members necessary because of hack for Client and init methods
6+
7+
.. automodule:: sentry_sdk
8+
:members:
9+
:inherited-members:

docs/index.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ This is the API documentation for `Sentry's Python SDK
66
<https://sentry.io/for/python/>`_. For full documentation and other resources
77
visit the `GitHub repository <https://github.com/getsentry/sentry-python>`_.
88

9-
.. inherited-members necessary because of hack for Client and init methods
10-
11-
.. automodule:: sentry_sdk
12-
:members:
13-
:inherited-members:
9+
.. toctree::
10+
api
11+
integrations

docs/integrations.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
============
2+
Integrations
3+
============
4+
5+
Logging
6+
=======
7+
8+
.. module:: sentry_sdk.integrations.logging
9+
10+
.. autofunction:: ignore_logger
11+
12+
.. autoclass:: EventHandler
13+
14+
.. autoclass:: BreadcrumbHandler

sentry_sdk/integrations/logging.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@
2727
_IGNORED_LOGGERS = set(["sentry_sdk.errors"])
2828

2929

30-
def ignore_logger(name):
31-
# type: (str) -> None
30+
def ignore_logger(
31+
name # type: str
32+
):
33+
# type: (...) -> None
3234
"""This disables recording (both in breadcrumbs and as events) calls to
3335
a logger of a specific name. Among other uses, many of our integrations
3436
use this to prevent their actions being recorded as breadcrumbs. Exposed
3537
to users as a way to quiet spammy loggers.
38+
39+
:param name: The name of the logger to ignore (same string you would pass to ``logging.getLogger``).
3640
"""
3741
_IGNORED_LOGGERS.add(name)
3842

@@ -146,6 +150,12 @@ def _extra_from_record(record):
146150

147151

148152
class EventHandler(logging.Handler, object):
153+
"""
154+
A logging handler that emits Sentry events for each log record
155+
156+
Note that you do not have to use this class if the logging integration is enabled, which it is by default.
157+
"""
158+
149159
def emit(self, record):
150160
# type: (LogRecord) -> Any
151161
with capture_internal_exceptions():
@@ -204,6 +214,12 @@ def _emit(self, record):
204214

205215

206216
class BreadcrumbHandler(logging.Handler, object):
217+
"""
218+
A logging handler that records breadcrumbs for each log record.
219+
220+
Note that you do not have to use this class if the logging integration is enabled, which it is by default.
221+
"""
222+
207223
def emit(self, record):
208224
# type: (LogRecord) -> Any
209225
with capture_internal_exceptions():

0 commit comments

Comments
 (0)