Skip to content

Commit 7bf0828

Browse files
committed
fix: emitterV2 cotr
1 parent 33c6d2b commit 7bf0828

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

logging_loki/emitter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, url: str, tags: dict | None = None, auth: BasicAuth = None, h
4444
self.auth = auth
4545
#: Optional headers for post request
4646
self.headers = headers or {}
47-
#: Verfify the host's ssl certificate
47+
#: Verify the host's ssl certificate
4848
self.verify_ssl = verify_ssl
4949

5050
self._session: requests.Session | None = None
@@ -149,8 +149,8 @@ class LokiEmitterV2(LokiEmitterV1):
149149
Enables passing additional headers to requests
150150
"""
151151

152-
def __init__(self, url: str, tags: dict | None = None, auth: BasicAuth = None, headers: dict = None):
153-
super().__init__(url, tags, auth, headers)
152+
def __init__(self, url: str, tags: dict | None = None, auth: BasicAuth = None, headers: dict = None, verify_ssl: bool = True):
153+
super().__init__(url, tags, auth, headers, verify_ssl)
154154

155155
def __call__(self, record: logging.LogRecord, line: str):
156156
"""Send log record to Loki."""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setuptools.setup(
99
name="python-logging-loki-v2",
10-
version="1.0.0",
10+
version="1.1.0",
1111
description="Python logging handler for Grafana Loki",
1212
long_description=long_description,
1313
long_description_content_type="text/markdown",

tests/test_emitter_v2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ def emitter_v2() -> Tuple[LokiEmitterV2, MagicMock]:
3535
return instance, session
3636

3737

38+
def test_init():
39+
LokiEmitterV2(url=emitter_url, headers=headers)
40+
LokiEmitterV2(url=emitter_url, headers=headers, tags={})
41+
LokiEmitterV2(url=emitter_url, headers=headers, tags={}, verify_ssl=True)
42+
43+
3844
@pytest.fixture()
3945
def emitter_v2_no_headers() -> Tuple[LokiEmitterV2, MagicMock]:
4046
"""Create v2 emitter with mocked http session."""

0 commit comments

Comments
 (0)