Skip to content

Commit 3323db9

Browse files
author
Vladimir Klochan
committed
Improved formatting of message fields. Added some docs. Updated license.
1 parent f40642a commit 3323db9

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013, Volodymyr Klochan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include LICENSE
2+
include README.rst

README.md README.rst

File renamed without changes.

logstash/handler.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@ def add_extra_fields(self, message_dict, record):
7373

7474
for key, value in record.__dict__.items():
7575
if key not in skip_list:
76-
message_dict['@fields'][key] = repr(value)
76+
if isinstance(value, (basestring, bool, dict, float, int, list, type(None))):
77+
message_dict['@fields'][key] = value
78+
else:
79+
message_dict['@fields'][key] = repr(value)
7780

7881
return message_dict
7982

8083
def format_exception(self, exc_info):
81-
return '\n'.join(traceback.format_exception(*exc_info)) if exc_info else ''
84+
return ''.join(traceback.format_exception(*exc_info)) if exc_info else ''
8285

8386
def format_timestamp(self, time):
8487
return datetime.utcfromtimestamp(time).isoformat()

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
packages=['logstash'],
55
version='0.1.2',
66
description='Python logging handler for Logstash.',
7-
long_description=open('README.md').read(),
8-
author='Vladimir Klochan',
7+
long_description=open('README.rst').read(),
8+
author='Volodymyr Klochan',
99
author_email='[email protected]',
1010
url='https://github.com/vklochan/python-logstash',
1111
classifiers=[
1212
'Development Status :: 4 - Beta',
1313
'Intended Audience :: Developers',
14-
'License :: Freeware',
14+
'License :: OSI Approved :: MIT License',
1515
'Operating System :: OS Independent',
1616
'Programming Language :: Python',
1717
'Topic :: Internet :: WWW/HTTP',

0 commit comments

Comments
 (0)