Browse Source

Merge pull request #28 from logzio/format-messages-on-exceptions

Treat exception and non-exception the same
opensearch
Roi Rav-Hon 7 years ago
committed by GitHub
parent
commit
b7a2913d72
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions
  1. +1
    -0
      README.md
  2. +9
    -5
      logzio/handler.py
  3. +1
    -1
      setup.py

+ 1
- 0
README.md View File

@ -147,6 +147,7 @@ LOGGING = {
- appname - Your django app - appname - Your django app
## Release Notes ## Release Notes
- 2.0.10 - Not ignoring formatting on exceptions
- 2.0.9 - Support extra fields on exceptions too (Thanks @asafc64!) - 2.0.9 - Support extra fields on exceptions too (Thanks @asafc64!)
- 2.0.8 - Various PEP8, testings and logging changes (Thanks @nir0s!) - 2.0.8 - Various PEP8, testings and logging changes (Thanks @nir0s!)
- 2.0.7 - Make sure sending thread is alive after fork (Thanks @jo-tham!) - 2.0.7 - Make sure sending thread is alive after fork (Thanks @jo-tham!)


+ 9
- 5
logzio/handler.py View File

@ -86,12 +86,16 @@ class LogzioHandler(logging.Handler):
if message.exc_info: if message.exc_info:
return_json['exception'] = self.format_exception(message.exc_info) return_json['exception'] = self.format_exception(message.exc_info)
# We want to ignore default logging formatting on exceptions
# As we handle those differently directly into exception field
message.exc_info = None
formatted_message = self.format(message)
if isinstance(formatted_message, dict):
return_json.update(formatted_message)
else: else:
formatted_message = self.format(message)
if isinstance(formatted_message, dict):
return_json.update(formatted_message)
else:
return_json['message'] = formatted_message
return_json['message'] = formatted_message
return_json.update(self.extra_fields(message)) return_json.update(self.extra_fields(message))
return return_json return return_json


+ 1
- 1
setup.py View File

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


Loading…
Cancel
Save