From 2cc5f4e37419828a115c86abc570ed4cf6027728 Mon Sep 17 00:00:00 2001 From: Roi Rav-Hon Date: Mon, 2 May 2016 17:58:56 +0300 Subject: [PATCH] Added readme and pipy related files --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg.py | 2 ++ setup.py | 26 +++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 README.md create mode 100644 setup.cfg.py create mode 100644 setup.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..d9f2ea8 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Logz.io python handler +Python handler that sends logs in bulk over https to logz.io. The handler use an internal buffer, and you can choose the drain timeout, and the number of messages to hold in queue before drain. Everything is working in threads, and they would exit after completing draining all the logs if the main program exits. + +## Installation +```bash +pip install logzio-python-handler +``` + +## Python configuration +#### Config File +``` +[handlers] +keys=LogzioHandler + +[handler_LogzioHandler] +class=logzio.handler.LogzioHandler +formatter=jsonFormat +args=('token', 10, 20) + +[formatters] +keys=jsonFormat + +[loggers] +keys=root + +[logger_root] +handlers=LogzioHandler +level=INFO + +[formatter_jsonFormat] +format={ "loggerName":"%(name)s", "functionName":"%(funcName)s", "lineNo":"%(lineno)d", "levelName":"%(levelname)s", "message":"%(message)s"} +``` +*args=() arguments, by order* + - Your logz.io token + - Number of logs to keep in buffer before draining + - Time to wait before draining, regardless of the previouse setting + - Log type, for searching in logz.io (defaults to "python") + +#### Code Example +```python +import logging +import logging.config + +# Say i have saved my configuration under ./myconf.conf +logging.config.fileConfig('myconf.conf') +logger = logging.getLogger('superAwesomeLogzioLogger') + +logger.info('Test log') +logger.warn('Warning') + +try: + 1/0 +except: + logger.exception("Supporting exceptions too!") +``` + +## Django configuration +TBD \ No newline at end of file diff --git a/setup.cfg.py b/setup.cfg.py new file mode 100644 index 0000000..3480374 --- /dev/null +++ b/setup.cfg.py @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..280b032 --- /dev/null +++ b/setup.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +from setuptools import setup, find_packages + +setup( + name="logzio-python-handler", + version='1.0.0', + description="Logging handler to send logs to your Logz.io account with bulk SSL", + keywords="logging handler logz.io bulk https", + author="roiravhon", + author_email="roi@logz.io", + url="https://github.com/logzio/logzio-python-handler/", + license="MIT", + packages=find_packages(), + install_requires=[ + "requests" + ], + include_package_data=True, + platform='any', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 2.7' + ] +) \ No newline at end of file