logtail-python 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {logtail_python-0.5.0 → logtail_python-0.5.1}/PKG-INFO +2 -2
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/__init__.py +3 -1
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/helpers.py +1 -2
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail_python.egg-info/PKG-INFO +2 -2
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail_python.egg-info/SOURCES.txt +2 -1
- {logtail_python-0.5.0 → logtail_python-0.5.1}/setup.py +1 -1
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_helpers.py +9 -0
- logtail_python-0.5.1/tests/typecheck/public_api.py +17 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/LICENSE.md +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/MANIFEST.in +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/README.md +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/compat.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/flusher.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/formatter.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/frame.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/handler.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/py.typed +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/rq.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail/uploader.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail_python.egg-info/dependency_links.txt +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail_python.egg-info/requires.txt +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/logtail_python.egg-info/top_level.txt +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/requirements.txt +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/setup.cfg +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/test-requirements.txt +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/__init__.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_flusher.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_formatter.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_frame.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_handler.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_rq.py +0 -0
- {logtail_python-0.5.0 → logtail_python-0.5.1}/tests/test_uploader.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logtail-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Better Stack client library
|
|
5
5
|
Home-page: https://github.com/logtail/logtail-python
|
|
6
|
-
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.
|
|
6
|
+
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.1
|
|
7
7
|
Author: Logtail
|
|
8
8
|
Author-email: hello@logtail.com
|
|
9
9
|
License: ISC
|
|
@@ -5,6 +5,8 @@ from .handler import LogtailHandler
|
|
|
5
5
|
from .helpers import LogtailContext, DEFAULT_CONTEXT
|
|
6
6
|
from .formatter import LogtailFormatter
|
|
7
7
|
|
|
8
|
-
__version__ = '0.5.
|
|
8
|
+
__version__ = '0.5.1'
|
|
9
9
|
|
|
10
10
|
context = DEFAULT_CONTEXT
|
|
11
|
+
|
|
12
|
+
__all__ = ['LogtailHandler', 'LogtailContext', 'DEFAULT_CONTEXT', 'LogtailFormatter', 'context', '__version__']
|
|
@@ -28,8 +28,7 @@ class LogtailContext(object):
|
|
|
28
28
|
return self
|
|
29
29
|
|
|
30
30
|
def __exit__(self, type_: Optional[type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> None:
|
|
31
|
-
|
|
32
|
-
self.extras.pop()
|
|
31
|
+
self.extras.pop()
|
|
33
32
|
|
|
34
33
|
def exists(self) -> bool:
|
|
35
34
|
return bool(self.extras)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logtail-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Better Stack client library
|
|
5
5
|
Home-page: https://github.com/logtail/logtail-python
|
|
6
|
-
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.
|
|
6
|
+
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.1
|
|
7
7
|
Author: Logtail
|
|
8
8
|
Author-email: hello@logtail.com
|
|
9
9
|
License: ISC
|
|
@@ -33,6 +33,15 @@ class TestLogtailContext(unittest.TestCase):
|
|
|
33
33
|
with c(user={'name': 'a'}):
|
|
34
34
|
raise ValueError('should be thrown')
|
|
35
35
|
|
|
36
|
+
def test_exception_leaves_the_context(self):
|
|
37
|
+
c = LogtailContext()
|
|
38
|
+
with c(user={'name': 'a'}):
|
|
39
|
+
with self.assertRaises(ValueError):
|
|
40
|
+
with c(request={'id': 'r'}):
|
|
41
|
+
raise ValueError('leaves the inner block')
|
|
42
|
+
self.assertEqual(c.collapse(), {'user': {'name': 'a'}})
|
|
43
|
+
self.assertFalse(c.exists())
|
|
44
|
+
|
|
36
45
|
def test_nested_collapse(self):
|
|
37
46
|
c = LogtailContext()
|
|
38
47
|
self.assertEqual(c.collapse(), {})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Checked with `mypy --strict` in CI, never run: imports and calls the public API the
|
|
2
|
+
# way applications do, so it fails if a name stops being exported from `logtail`.
|
|
3
|
+
import json
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
import logtail
|
|
7
|
+
from logtail import DEFAULT_CONTEXT, LogtailContext, LogtailFormatter, LogtailHandler
|
|
8
|
+
|
|
9
|
+
handler = LogtailHandler(source_token='token', host='in.logs.betterstack.com', timeout=(3.05, 27), flush_timeout=None)
|
|
10
|
+
handler.setFormatter(LogtailFormatter(context=DEFAULT_CONTEXT, json_default=str, json_encoder=json.JSONEncoder))
|
|
11
|
+
logging.getLogger(__name__).addHandler(handler)
|
|
12
|
+
|
|
13
|
+
request_context: LogtailContext = logtail.context
|
|
14
|
+
with request_context(request={'id': 'abc'}):
|
|
15
|
+
logging.getLogger(__name__).info('typed')
|
|
16
|
+
|
|
17
|
+
version: str = logtail.__version__
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|