Metadata-Version: 2.1
Name: asynclog
Version: 0.1.4
Summary: Asynchronous log for python logging.
Home-page: https://github.com/unpluggedcoder/asynclog
Author: unpluggedcoder
Author-email: unpluggedcoder@outlook.com
License: MIT
Description: ## asynclog
        [![Build Status](https://travis-ci.org/unpluggedcoder/asynclog.svg?branch=master)](https://travis-ci.org/unpluggedcoder/asynclog) [![Coverage Status](https://coveralls.io/repos/github/unpluggedcoder/asynclog/badge.svg?branch=master)](https://coveralls.io/github/unpluggedcoder/asynclog?branch=master)
        
        `asynclog` provide the asynchronous way for python logging. Leave the logging I/O(especially the network I/O when we want to logging to a network endpoint) to the asynchronous thread or asynchronous task provided by [celery](http://www.celeryproject.org/) .
        
        #### Requirements
        
        * Python 3.5+
        
        #### Install
        
        ```shell
        python setup.py install
        ```
        
        #### Usage
        
        * Using thread
        
        ```python
        import logging
        import time
        
        from asynclog import AsyncLogDispatcher
        
        
        def write_log(msg):
            # Do write stuff, such as write log msg into network.
            # ...
            time.sleep(0.5)
        
        
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        handler = AsyncLogDispatcher(write_log)
        handler.setLevel(logging.INFO)
        logger.addHandler(handler)
        
        logger.info('Test Log')
        ```
        
        * Using Celery
        
        ```python
        from celery import shared_task
        
        @shared_task
        def write_task(msg):
            # Write log in Network IO
            print(msg)
            
        celery_handler = AsyncLogDispatcher(write_task, use_thread=False, use_celery=True)
        celery_handler.setLevel(logging.INFO)
        logger.addHandler(celery_handler)
        
        logger.info('Test Log')
        ```
        
        #### Test
        
        ```shell
        python -m unittest
        ....
        ----------------------------------------------------------------------
        Ran 4 tests in 0.003s
        
        OK
        ```
        
        
        
        
Keywords: logging asynchronous
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Logging
Description-Content-Type: text/markdown
