Permalink
Browse files

Reorganized packaging and added manifest files

  • Loading branch information...
1 parent 9931b4c commit f9b4e4225b1541ac31fbca17e0882bd57c14cd42 @mattmcclean committed Feb 14, 2012
View
@@ -0,0 +1 @@
+v0.1, 2012-02-14 -- Initial release
View
@@ -0,0 +1,2 @@
+include *.txt
+recursive-include docs *.txt
View
@@ -0,0 +1,15 @@
+===========
+Logstash
+===========
+
+Logstash provides library for creating logstash messages from Python.
+The most useful class is the Event class that formats a JSON object into
+a Python class.
+
+ #!/usr/bin/env python
+
+ import logstash
+
+ event = logstash.Event(json_data)
+
+For more information on logstash goto the website `here <http://www.logstash.net/>`_
View
@@ -0,0 +1,2 @@
+__all__ = ['Event']
+from event import Event
@@ -3,7 +3,7 @@
import urlparse
import copy
-class LogEvent(object):
+class Event(object):
def __init__(self, json_obj = None):
self.cancelled = False
File renamed without changes.
@@ -1,13 +1,13 @@
import unittest
import json
import time
-from logstash import LogEvent
+from logstash.event import Event
class Test(unittest.TestCase):
"""Unit tests for logstash."""
def test_create_new_event(self):
- event = LogEvent()
+ event = Event()
self.assertEqual(event.getsource(), 'unknown')
self.assertEqual(event.gettags(), [])
@@ -27,7 +27,7 @@ def test_create_from_json(self):
"@timestamp" : time.strftime("%Y-%m-%dT%H:%M:%S",now),
"@message" : "This is the message"
})
- event = LogEvent(data)
+ event = Event(data)
self.assertEqual(event.getsource(), 'test01.example.com')
self.assertEqual(event.gettags(), ['tag1', 'tag2', 'tag3'])
self.assertEqual(event.getfields(), { "key1" : "field1",
@@ -51,7 +51,7 @@ def test_get_fields(self):
"@timestamp" : time.strftime("%Y-%m-%dT%H:%M:%S",now),
"@message" : "This is the message"
})
- event = LogEvent(data)
+ event = Event(data)
self.assertEqual(event.get("@source"), 'test01.example.com')
self.assertEqual(event.get("@tags"), ['tag1', 'tag2', 'tag3'])
self.assertEqual(event.get("key1"), "field1")
@@ -62,14 +62,14 @@ def test_get_fields(self):
self.assertEqual(event.get("@message"), "This is the message")
def test_set_source(self):
- event = LogEvent()
+ event = Event()
event.setsource("http://www.example.com/some/path")
self.assertEqual(event.get("@source"), "http://www.example.com/some/path")
self.assertEqual(event.get("@source_host"), "www.example.com")
self.assertEqual(event.get("@source_path"), "/some/path")
- event = LogEvent()
+ event = Event()
event.setsource("www.example.com")
self.assertEqual(event.get("@source"), "www.example.com")
self.assertEqual(event.get("@source_host"), "www.example.com")
View
@@ -2,10 +2,13 @@
from distutils.core import setup
-setup(name='Logstash',
+setup(name='logstash',
version='0.1dev',
description='Python library for Logstash',
author='Matt McClean',
author_email='matt.mcclean@gmail.com',
- packages=['logstash',],
+ packages=['logstash', 'logstash.test'],
+ license='LICENSE.txt',
+ description='Python library for Logstash.',
+ long_description=open('README.txt').read(),
)

0 comments on commit f9b4e42

Please sign in to comment.