Browse Source

flake8 tests, setuptools upgrade and readme update

master
ralongit 1 year ago
parent
commit
66fc33bb93
4 changed files with 18 additions and 3 deletions
  1. +13
    -0
      README.md
  2. +4
    -1
      logzio/handler.py
  3. +0
    -1
      logzio/sender.py
  4. +1
    -1
      requirements.txt

+ 13
- 0
README.md View File

@ -26,6 +26,11 @@ In case the logs failed to be sent to Logz.io after a couple of tries, they will
pip install logzio-python-handler
```
If you'd like to use [Trace context](https://github.com/logzio/logzio-python-handler#trace-context) then you need to install the OpenTelemetry logging instrumentation dependecy by running the following command:
```bash
pip install logzio-python-handler[opentelemetry-logging]
```
## Tested Python Versions
Travis CI will build this handler and test against:
- "3.5"
@ -33,6 +38,8 @@ Travis CI will build this handler and test against:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
We can't ensure compatibility to any other version, as we can't test it automatically.
@ -216,6 +223,12 @@ LOGGING = {
If you're sending traces with OpenTelemetry instrumentation (auto or manual), you can correlate your logs with the trace context.
That way, your logs will have traces data in it, such as service name, span id and trace id.
Make sure to install the OpenTelemetry logging instrumentation dependecy by running the following command:
```bash
pip install logzio-python-handler[opentelemetry-logging]
```
To enable this feature, set the `add_context` param in your handler configuration to `True`, like in this example:
```python


+ 4
- 1
logzio/handler.py View File

@ -34,7 +34,10 @@ class LogzioHandler(logging.Handler):
from opentelemetry.instrumentation.logging import LoggingInstrumentor
LoggingInstrumentor().instrument(set_logging_format=True)
except ImportError:
print("Can't add trace context. OpenTelemetry logging optional package isn't installed.\nPlease install the following:\npip install 'logzio-python-handler[opentelemetry-logging]'")
print("""Can't add trace context.
OpenTelemetry logging optional package isn't installed.
Please install the following package:
pip install 'logzio-python-handler[opentelemetry-logging]'""")
self.logzio_sender = LogzioSender(
token=token,
url=url,


+ 0
- 1
logzio/sender.py View File

@ -9,7 +9,6 @@ from threading import Thread, enumerate
import requests
from .logger import get_logger
from .logger import get_stdout_logger
if sys.version[0] == '2':


+ 1
- 1
requirements.txt View File

@ -1,3 +1,3 @@
requests>=2.27.0
protobuf>=3.20.2
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
setuptools>=68.0.0 # not directly required, pinned by Snyk to avoid a vulnerability

Loading…
Cancel
Save