-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tox configuration and static code analysis (flake8, pylint)
Convert README to reStructuredText (was: MarkDown) for PyPI Add full text of license (identical to Sentry project) Use standard naming for contributors file Move package information to __init__ file
- Loading branch information
Showing
11 changed files
with
175 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ build/config/buildinfo.properties | |
env | ||
|
||
# Packages | ||
*.egg | ||
*.egg[s] | ||
*.egg-info | ||
dist | ||
build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Mauro De Giorgi (mdgart) | ||
Julian Perelli (jperelli) | ||
Peter Bittner (bittner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright (c) 2012-2016 Mauro De Giorgi (mdgart) and individual contributors. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the Sentry nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
include *.txt | ||
include *.md | ||
include *.rst | ||
recursive-include docs *.txt | ||
recursive-include sentrylogs/conf *.py | ||
prune sentrylogs/env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
Sentry Logs | ||
=========== | ||
|
||
Sentry Logs allows you to send Logs to Sentry, only Nginx error log is currently supported, | ||
but I'm planning to extend the library to support more logs file. | ||
|
||
Sentry Logs allows you to send Logs to Sentry, only Nginx error log is | ||
currently supported, but extending the library to support more log files | ||
is planned. | ||
|
||
How it works | ||
============ | ||
|
@@ -17,10 +17,9 @@ or:: | |
|
||
easy_install sentrylogs | ||
|
||
This will install the module and you will have a new command line available:: | ||
|
||
sentrylogs -h | ||
This will install the module and will provide a new console command:: | ||
|
||
$ sentrylogs -h | ||
|
||
usage: sentrylogs [-h] [--follow FOLLOW] [--sentrydsn SENTRYDSN] [--daemonize] | ||
[--nginxerrorpath NGINXERRORPATH] | ||
|
@@ -37,24 +36,19 @@ This will install the module and you will have a new command line available:: | |
--nginxerrorpath NGINXERRORPATH, -n NGINXERRORPATH | ||
Nginx error log path | ||
|
||
You must provide a Sentry DSN to make it work; you have 2 possibilities: | ||
|
||
you must provide a Sentry DSN to make it works; at this moment you have 2 possibilities: | ||
|
||
set up an environment variable: | ||
|
||
$ export SENTRY_DSN="protocol://public:secret@example.com/#" | ||
$ sentrylogs | ||
|
||
or use the --sentrydsn argument: | ||
|
||
$ sentrylogs --sentrydsn "protocol://public:secret@example.com/#" | ||
|
||
By defauld it will seach for nginx log at /var/log/nginx/error.log, but you can change it using --nginxerrorpath | ||
|
||
If you use --daemonize the command will daemonize itself and will run in background. | ||
|
||
Provide an environment variable:: | ||
|
||
$ export SENTRY_DSN="protocol://public:[email protected]/#" | ||
$ sentrylogs | ||
|
||
or use the ``--sentrydsn`` command line argument:: | ||
|
||
$ sentrylogs --sentrydsn "protocol://public:[email protected]/#" | ||
|
||
By default *sentrylogs* will assume the nginx log at ``/var/log/nginx/error.log``, | ||
but you can change this using the ``--nginxerrorpath`` argument. | ||
|
||
If you use ``--daemonize`` the command will daemonize itself and run in | ||
background. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
raven>=2.0.10 | ||
tailer>=0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
|
||
""" | ||
Send logs to Django Sentry. | ||
""" | ||
__author__ = 'Mauro De Giorgi' | ||
__author_email__ = '[email protected]' | ||
__license__ = 'BSD' | ||
__url__ = 'https://github.com/mdgart/sentrylogs' | ||
__version__ = '1.1.0.dev' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,103 @@ | ||
from glob import glob | ||
from setuptools import setup | ||
from setuptools.command.test import test as TestCommand # noqa N812 | ||
from shlex import split | ||
from shutil import rmtree | ||
from os import remove | ||
from os.path import abspath, dirname, join | ||
|
||
import sentrylogs as package | ||
|
||
|
||
class Tox(TestCommand): | ||
user_options = [('tox-args=', 'a', "Arguments to pass to tox")] | ||
|
||
def initialize_options(self): | ||
TestCommand.initialize_options(self) | ||
self.tox_args = None | ||
|
||
def finalize_options(self): | ||
TestCommand.finalize_options(self) | ||
self.test_args = [] | ||
self.test_suite = True | ||
|
||
def run_tests(self): | ||
from tox import cmdline | ||
args = self.tox_args | ||
if args: | ||
args = split(self.tox_args) | ||
errno = cmdline(args=args) | ||
exit(errno) | ||
|
||
|
||
class Clean(TestCommand): | ||
def run(self): | ||
delete_in_root = [ | ||
'build', | ||
'dist', | ||
'.eggs', | ||
'*.egg-info', | ||
'.tox', | ||
] | ||
delete_everywhere = [ | ||
'__pycache__', | ||
'*.pyc', | ||
] | ||
for candidate in delete_in_root: | ||
rmtree_glob(candidate) | ||
for visible_dir in glob('[A-Za-z0-9]*'): | ||
for candidate in delete_everywhere: | ||
rmtree_glob(join(visible_dir, candidate)) | ||
rmtree_glob(join(visible_dir, '*', candidate)) | ||
rmtree_glob(join(visible_dir, '*', '*', candidate)) | ||
|
||
|
||
def rmtree_glob(file_glob): | ||
for fobj in glob(file_glob): | ||
try: | ||
rmtree(fobj) | ||
print('%s/ removed ...' % fobj) | ||
except OSError: | ||
try: | ||
remove(fobj) | ||
print('%s removed ...' % fobj) | ||
except OSError as err: | ||
print(err) | ||
|
||
|
||
def read_file(filename): | ||
with open(join(abspath(dirname(__file__)), filename)) as f: | ||
return f.read() | ||
|
||
|
||
setup( | ||
name='SentryLogs', | ||
version='0.0.9', | ||
author='Mauro De Giorgi', | ||
author_email='[email protected]', | ||
scripts=['bin/sentrylogs',], | ||
version=package.__version__, | ||
author=package.__author__, | ||
author_email=package.__author_email__, | ||
classifiers=[ | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
], | ||
description=package.__doc__.strip(), | ||
long_description=read_file('README.rst'), | ||
license=package.__license__, | ||
url=package.__url__, | ||
install_requires=read_file('requirements.txt'), | ||
scripts=['bin/sentrylogs'], | ||
packages=['sentrylogs', 'sentrylogs.conf', 'sentrylogs.parsers'], | ||
url='http://pypi.python.org/pypi/SentryLogs/', | ||
license='LICENSE.txt', | ||
description='Send logs to Django Sentry.', | ||
long_description=open('README.md').read(), | ||
install_requires=[ | ||
"raven >= 2.0.10", | ||
"tailer >= 0.3", | ||
], | ||
) | ||
test_suite='tests', | ||
tests_require=['tox'], | ||
cmdclass={ | ||
'clean': Clean, | ||
'test': Tox, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[flake8] | ||
max-line-length = 90 | ||
exclude = build,dist,reports,*.egg-info | ||
|
||
[pylint] | ||
;disable = invalid-name,missing-docstring | ||
;ignore = migrations | ||
;ignore-docstrings = yes | ||
output-format = colorized | ||
reports = no | ||
|
||
[tox] | ||
envlist = | ||
flake8 | ||
pylint | ||
; py{26,27} | ||
; py{32,33,34,35} | ||
|
||
[testenv] | ||
basepython = python3.4 | ||
;deps = pytest | ||
commands = | ||
python setup.py -q install | ||
py.test | ||
|
||
[testenv:flake8] | ||
deps = flake8 | ||
commands = flake8 | ||
|
||
[testenv:pylint] | ||
deps = pylint | ||
commands = pylint --rcfile=tox.ini sentrylogs |