Browse Source

Support for extra fields

opensearch
TomasKuznetsov 7 years ago
parent
commit
3586b73936
3 changed files with 13 additions and 2 deletions
  1. +12
    -0
      README.md
  2. +1
    -1
      setup.py
  3. +0
    -1
      tests/test_logzioHandler.py

+ 12
- 0
README.md View File

@ -75,6 +75,17 @@ except:
logger.exception("Supporting exceptions too!")
```
#### Extra Fields
In case you need to dynamic metadata to your logger, other then the constant metadata from the formatter, you can use the "extra" parameter.
All key values in the dictionary passed in "extra" will be presented in Logz.io as new fields in the log you are sending.
Please note, that you cannot override default fields by the python logger (i.e. lineno, thread, etc..)
For example:
```
logger.info('Warning', extra={'extra_key':'extra_value'})
```
## Django configuration
```
LOGGING = {
@ -127,6 +138,7 @@ LOGGING = {
- appname - Your django app
## Release Notes
- 2.0.5 - Support for extra fields
- 2.0.4 - Publish package as source along wheel, and supprt python3 packagin (Thanks @cchristous!)
- 2.0.3 - Fix bug that consumed more logs while draining than Logz.io's bulk limit
- 2.0.2 - Support for formatted messages (Thanks @johnraz!)


+ 1
- 1
setup.py View File

@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup(
name="logzio-python-handler",
version='2.0.4',
version='2.0.5',
description="Logging handler to send logs to your Logz.io account with bulk SSL",
keywords="logging handler logz.io bulk https",
author="roiravhon",


+ 0
- 1
tests/test_logzioHandler.py View File

@ -91,7 +91,6 @@ class TestLogzioHandler(TestCase):
record.__dict__["extra_key"] = "extra_value"
record.__dict__["module"] = "testing"
formatted_message = self.handler.format_message(record)
formatted_message["@timestamp"] = None


Loading…
Cancel
Save