diff --git a/logging_loki/emitter.py b/logging_loki/emitter.py index f5f484c..1c45d86 100644 --- a/logging_loki/emitter.py +++ b/logging_loki/emitter.py @@ -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 @@ -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.""" diff --git a/setup.py b/setup.py index a52f8c2..59c22f6 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_emitter_v2.py b/tests/test_emitter_v2.py index 359f131..88049b8 100644 --- a/tests/test_emitter_v2.py +++ b/tests/test_emitter_v2.py @@ -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."""