{ "info": { "author": "Duong Nguyen Anh Khoa", "author_email": "dnanhkhoa@live.com", "bugtrack_url": null, "classifiers": [], "description": "# LogOne\r\n\r\n![Logone status](https://img.shields.io/pypi/v/logone.svg)\r\n\r\nA simple logger which supports for logging stdout and stderr streams to console, file, and Loggly for Python\r\n\r\n## Core Features\r\n\r\n+ Simple and easy to use, and also compatible with `logging` package\r\n\r\n+ Supports for logging to console, file, and [Loggly](https://www.loggly.com) service in real-time\r\n\r\n+ Redirects stdout or stderr stream to the logger as log messages\r\n\r\n+ Supports for color and formatting to terminal logging (based on `coloredlogs` package)\r\n\r\n+ Works with Python 2 and 3\r\n\r\n## Todo\r\n\r\n+ [ ] Supports for forwarding logs to Facebook Messenger, Slack, ...\r\n\r\n## Installation\r\n\r\n`logone` can be installed using [pip](http://www.pip-installer.org):\r\n\r\n```\r\n$ [sudo] pip install logone\r\n```\r\n\r\n## Example Usage\r\n\r\nHere is an example of how easy it is to get started:\r\n\r\n```python\r\n#!/usr/bin/python\r\n# -*- coding: utf-8 -*-\r\nimport logone\r\n\r\n# Indicate `DEBUG` level (or higher) for the root logger\r\nlogone.set_level(level=logone.DEBUG)\r\n\r\n# Now, we can log anything to the root logger\r\nlogone.debug('Quick zephyrs blow, vexing daft Jim')\r\nlogone.info('How quickly daft jumping zebras vex')\r\n\r\n\r\ndef main():\r\n # Create a new logger if you do not want to use the root logger\r\n logger = logone.get_logger('example')\r\n logger.set_level(logone.DEBUG)\r\n\r\n # Log something to the logger\r\n logger.debug('Debug message')\r\n logger.info('Info message')\r\n logger.warning('Warn message')\r\n\r\n # Set up the logger for logging `DEBUG` messages or higher to `example.log` file\r\n # Learn more at: https://docs.python.org/3/library/logging.handlers.html#logging.handlers.TimedRotatingFileHandler\r\n logger.use_file(enabled=True, file_name='logs/example.log', level=logone.DEBUG,\r\n when='d', interval=1, backup_count=10)\r\n\r\n # Set up the logger for logging `DEBUG` messages or higher to Loggly service in real-time\r\n logger.use_loggly(enabled=True, level=logone.DEBUG,\r\n loggly_token='YOUR-CUSTOMER-TOKEN', loggly_tag='Python,Example')\r\n\r\n # Log something to the logger, file, and Loggly service\r\n logger.error('Error message')\r\n logger.critical('Critical message')\r\n\r\n # Redirect stdout stream to the logger as `INFO` messages (for `print` function,...)\r\n logger.redirect_stdout(enabled=True, log_level=logone.INFO)\r\n # Redirect stderr stream to the logger as `ERROR` messages (for unexpected error,...)\r\n logger.redirect_stderr(enabled=True, log_level=logone.ERROR)\r\n\r\n # These will be written to stdout stream and then redirected to the logger\r\n print('Jackdaws love my big sphinx of quartz')\r\n\r\n value = 20\r\n print('Value = ', value)\r\n\r\n # ZeroDivisionError exception will be written to stderr stream and then redirected to the logger\r\n value = 1 / 0\r\n print(value)\r\n\r\n\r\nif __name__ == '__main__':\r\n main()\r\n```\r\n\r\nAnd here is terminal output:\r\n\r\n![Demo](https://raw.githubusercontent.com/dnanhkhoa/logone/master/screenshots/demo.png)\r\n\r\n## License\r\n\r\nMIT\r\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dnanhkhoa/logone", "keywords": "logone logger logging loggly stream log file stdout stderr", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "logone", "package_url": "https://pypi.org/project/logone/", "platform": "", "project_url": "https://pypi.org/project/logone/", "project_urls": { "Homepage": "https://github.com/dnanhkhoa/logone" }, "release_url": "https://pypi.org/project/logone/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "A simple logger which supports for logging stdout and stderr streams to console, file, and Loggly for Python", "version": "0.1.7" }, "last_serial": 3537978, "releases": { "0.1.7": [ { "comment_text": "", "digests": { "md5": "a0b7815c075f970d44644abb2c33e7e4", "sha256": "512c8828dfd8dd39e8adadc0e9cbc2836a86c936261c2d36a7efd82e3680675c" }, "downloads": -1, "filename": "logone-0.1.7.tar.gz", "has_sig": false, "md5_digest": "a0b7815c075f970d44644abb2c33e7e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7284, "upload_time": "2018-01-31T10:34:38", "url": "https://files.pythonhosted.org/packages/39/7d/69f5e5cdaa2b3c1bc146fc61617a6cc004b3a7890850c5df4facf82399d3/logone-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a0b7815c075f970d44644abb2c33e7e4", "sha256": "512c8828dfd8dd39e8adadc0e9cbc2836a86c936261c2d36a7efd82e3680675c" }, "downloads": -1, "filename": "logone-0.1.7.tar.gz", "has_sig": false, "md5_digest": "a0b7815c075f970d44644abb2c33e7e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7284, "upload_time": "2018-01-31T10:34:38", "url": "https://files.pythonhosted.org/packages/39/7d/69f5e5cdaa2b3c1bc146fc61617a6cc004b3a7890850c5df4facf82399d3/logone-0.1.7.tar.gz" } ] }