Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# http://nedbatchelder.com/code/coverage/config.html#config

[run]
branch = True
omit = */tests/*

[report]
omit = */tests/*
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- "pip install --use-mirrors -e ."
- "pip install coverage coveralls"
script:
- "python ./setup.py nosetests"
after_success:
- coveralls
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# A Python structured logger for Fluentd

[![Build Status](https://travis-ci.org/EvaSDK/fluent-logger-python.svg?branch=master)](https://travis-ci.org/EvaSDK/fluent-logger-python)
[![Coverage Status](https://coveralls.io/repos/EvaSDK/fluent-logger-python/badge.png)](https://coveralls.io/r/EvaSDK/fluent-logger-python)

Many web/mobile applications generate huge amount of event logs (c,f. login, logout, purchase, follow, etc). To analyze these event logs could be really valuable for improving the service. However, the challenge is collecting these logs easily and reliably.

Expand Down
9 changes: 7 additions & 2 deletions fluent/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@

try:
import simplejson as json
except ImportError:
except ImportError: # pragma: no cover
import json

try:
basestring
except NameError: # pragma: no cover
basestring = (str, bytes)

from fluent import sender


Expand Down Expand Up @@ -75,4 +80,4 @@ def close(self):
self.sender._close()
logging.Handler.close(self)
finally:
self.release()
self.release()
6 changes: 0 additions & 6 deletions run_tests.py

This file was deleted.

8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[nosetests]
match = ^test_
cover-package = fluent
with-coverage = 1
cover-erase = 1
cover-branches = 1
cover-inclusive = 1
cover-min-percentage = 70
6 changes: 0 additions & 6 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
# -*- coding: utf-8 -*-

from tests.test_event import *
from tests.test_handler import *
from tests.test_sender import *
from tests.test_unix_domain_socket_sender import *
2 changes: 1 addition & 1 deletion tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class TestEvent(unittest.TestCase):
def testLogging(self):
def test_logging(self):
# send event with tag app.follow
event.Event('follow', {
'from': 'userA',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ def test_simple(self):
eq('app.follow', data[0][0])
eq('userA', data[0][2]['from'])
eq('userB', data[0][2]['to'])
self.assert_(data[0][1])
self.assert_(isinstance(data[0][1], int))
self.assertTrue(data[0][1])
self.assertTrue(isinstance(data[0][1], int))
4 changes: 2 additions & 2 deletions tests/test_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def test_simple(self):
eq(3, len(data[0]))
eq('test.foo', data[0][0])
eq({'bar': 'baz'}, data[0][2])
self.assert_(data[0][1])
self.assert_(isinstance(data[0][1], int))
self.assertTrue(data[0][1])
self.assertTrue(isinstance(data[0][1], int))
17 changes: 6 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
[tox]
envlist = py26, py27, py32
minversion = 1.7.2
envlist = py26, py27, py32, py33, py34
skip_missing_interpreters = True

[testenv]
commands=python setup.py test

[testenv:py26]
basepython = python2.6

[testenv:py27]
basepython = python2.7

[testenv:py32]
basepython = python3.2
deps = nose
coverage
commands = python setup.py nosetests