Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions logging_loki/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, url: str, tags: dict | None = None, auth: BasicAuth = None, h
self.auth = auth
#: Optional headers for post request
self.headers = headers or {}
#: Verfify the host's ssl certificate
#: Verify the host's ssl certificate
self.verify_ssl = verify_ssl

self._session: requests.Session | None = None
Expand Down Expand Up @@ -149,8 +149,8 @@ class LokiEmitterV2(LokiEmitterV1):
Enables passing additional headers to requests
"""

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

def __call__(self, record: logging.LogRecord, line: str):
"""Send log record to Loki."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="python-logging-loki-v2",
version="1.0.0",
version="1.1.0",
description="Python logging handler for Grafana Loki",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
6 changes: 6 additions & 0 deletions tests/test_emitter_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def emitter_v2() -> Tuple[LokiEmitterV2, MagicMock]:
return instance, session


def test_init():
LokiEmitterV2(url=emitter_url, headers=headers)
LokiEmitterV2(url=emitter_url, headers=headers, tags={})
LokiEmitterV2(url=emitter_url, headers=headers, tags={}, verify_ssl=True)


@pytest.fixture()
def emitter_v2_no_headers() -> Tuple[LokiEmitterV2, MagicMock]:
"""Create v2 emitter with mocked http session."""
Expand Down