diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07081b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +config +# modules + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject diff --git a/MyApp.py b/MyApp.py deleted file mode 100644 index 8e9dd46..0000000 --- a/MyApp.py +++ /dev/null @@ -1,25 +0,0 @@ -import socket - -from helpers import customLogger, customMQTTLogger - - -def test_logging(): - logger = customLogger('customLogger','MyApp.log') - - mqtt_logger = customMQTTLogger('customMQTTLogger', level='DEBUG', TOPIC='testLogging', BROKER='192.168.6.17') - - logger.debug("debug message") - mqtt_logger.logger.debug("debug message") - - logger.info("info message") - logger.warning("warning message") - logger.error("error message") - logger.critical("critical message") - - logger.info("Hello World") - logger.info("Request from {} handled in {:.3f} ms", socket.gethostname(), 11) - logger.info("Request from {} handled in {:.3f} ms", "127.0.0.1", 33.1) - - -if __name__ == "__main__": - test_logging() \ No newline at end of file diff --git a/helpers/MessageHandler.py b/customLogger/MessageHandler.py similarity index 100% rename from helpers/MessageHandler.py rename to customLogger/MessageHandler.py diff --git a/helpers/__init__.py b/customLogger/__init__.py similarity index 100% rename from helpers/__init__.py rename to customLogger/__init__.py diff --git a/helpers/customLogger.py b/customLogger/customLogger.py similarity index 100% rename from helpers/customLogger.py rename to customLogger/customLogger.py diff --git a/helpers/customMQTTLogger.py b/customLogger/customMQTTLogger.py similarity index 100% rename from helpers/customMQTTLogger.py rename to customLogger/customMQTTLogger.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..40eb135 --- /dev/null +++ b/setup.py @@ -0,0 +1,31 @@ +from distutils.core import setup + +import setuptools + +try: + long_description = open("README").read() +except: + long_description = """Custom Logger with coloring etc. in Python""" + +if __name__ == "__main__": + setup(name="PythonCustomLogger", + version='1.0', + description="PythonCustomLogger-add text here...", + long_description=long_description, + long_description_content_type="text/markdown", + author="Dominik Kuhn", + author_email="d.kuhn@zema.de", + maintainer="Dominik Kuhn", + maintainer_email="d.kuhn@zema.de", + install_requires=['paho-mqtt','bunyan'], + url="https://git.zema.de/tfs/ZISS/_git/PythonCustomLogger", + packages=["customLogger"], + classifiers=[ + # "Development Status :: 4 - Production/Stable", + # "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering", + "Topic :: Software Development :: Libraries :: Python Modules", + ], + )