Skip to content

Commit 55cc5a7

Browse files
committed
contrib/flask: remove deprecated log shipping integration
1 parent 508a740 commit 55cc5a7

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

elasticapm/contrib/flask/__init__.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,15 @@
3131

3232
from __future__ import absolute_import
3333

34-
import logging
35-
import warnings
36-
3734
import flask
3835
from flask import request, signals
3936

4037
import elasticapm
4138
import elasticapm.instrumentation.control
4239
from elasticapm import get_client
4340
from elasticapm.base import Client
44-
from elasticapm.conf import constants, setup_logging
41+
from elasticapm.conf import constants
4542
from elasticapm.contrib.flask.utils import get_data_from_request, get_data_from_response
46-
from elasticapm.handlers.logging import LoggingHandler
4743
from elasticapm.traces import execution_context
4844
from elasticapm.utils import build_name_with_http_method_prefix
4945
from elasticapm.utils.disttracing import TraceParent
@@ -81,14 +77,8 @@ class ElasticAPM(object):
8177
>>> elasticapm.capture_message('hello, world!')
8278
"""
8379

84-
def __init__(self, app=None, client=None, client_cls=Client, logging=False, **defaults) -> None:
80+
def __init__(self, app=None, client=None, client_cls=Client, **defaults) -> None:
8581
self.app = app
86-
self.logging = logging
87-
if self.logging:
88-
warnings.warn(
89-
"Flask log shipping is deprecated. See the Flask docs for more info and alternatives.",
90-
DeprecationWarning,
91-
)
9282
self.client = client or get_client()
9383
self.client_cls = client_cls
9484

@@ -127,14 +117,6 @@ def init_app(self, app, **defaults) -> None:
127117

128118
self.client = self.client_cls(config, **defaults)
129119

130-
# 0 is a valid log level (NOTSET), so we need to check explicitly for it
131-
if self.logging or self.logging is logging.NOTSET:
132-
if self.logging is not True:
133-
kwargs = {"level": self.logging}
134-
else:
135-
kwargs = {}
136-
setup_logging(LoggingHandler(self.client, **kwargs))
137-
138120
signals.got_request_exception.connect(self.handle_exception, sender=app, weak=False)
139121

140122
try:

0 commit comments

Comments
 (0)