logpilot


Namelogpilot JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/garethng/loggly
SummaryCommon Logger
upload_time2024-01-05 08:18:00
maintainer
docs_urlNone
authorGareth Ng
requires_python
licenseMIT license
keywords loggly logging log
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # logpilot
logpilot is a project to extend python standard logging to offer customizing ability.

### Install
```bash
pip install logpilot
```

### Log format  

we only support format like this:  
```bash
#--------------------------------------------------
# Log Format
#--------------------------------------------------
# %(asctime)s.%(msecs)03d      yyyy-mm-dd HH:MM:SS 2016-01-01 00:00:00.000
# %(filename)s      
# %(pathname)s      Full path 
# %(funcName)s      
# %(levelname)s     
# %(lineno)d        
# %(module)s        
# %(message)s       
# %(name)s          
# %(processName)s   
# %(threadName)s    
# %(hostname)s      FQDN
# %(uuid)s          custom uuid 
# %(elapsed)s       (ms)
%(asctime)s.%(msecs)03d|%(levelname)s|%(name)s|%(filename)s|%(lineno)d|%(module)s|%(funcName)s|%(processName)s|%(threadName)s|%(message)s|%(hostname)s|%(uuid)s|%(elapsed)s
```

### How to use  
```python
from logpilot.log import Log

log = Log.get_logger(__name__)


class Example(object):

    def __init__(self):
      log.info(msg="this is a test for logpilot", uuid="2b24bad1c5df6b4551768fe09ae877b893fc35505847e80f119c395bca27", elapsed=256)
```

### example log
```bash
2016-11-17 14:35:59|DEBUG|__main__|test2_log.py|11|test2_log|__init__|MainProcess|MainThread|this is a test for logpilot|localhost|2b24bad1c5df6b4551768fe09ae877b893fc35505847e80f119c395bca27|256
```

### How to set global uuid

```python
from logpilot.log import Log
log = Log.get_logger(__name__, uuid='hsdfhkd')
log.info(msg="this is a test logpilot", elapsed=8888)
log.info(msg='hahah', uuid='5678')
log.debug(msg="android world", elapsed=234)
# notice that uuid also can be override
log.error(msg="ios world", uuid='jaj', elapsed=99)
```


### How to change log level
  
default DEBUG

```python  
import logging
from logpilot.log import Log

log = Log.get_logger('test2222')
log.logger.setLevel(logging.INFO)


class Test(object):

    def __init__(self):
        log.info(msg="this is a test logpilot", hahah='hooooo.', age=10000, fake_key='not valid')
        
if __name__ == '__main__':
    from logpilot.log import Log
    a = Test()
    log.debug(msg="this is a test logpilot", hahah='hooooo.', uuid="1234567890")
```  

### TODO:
-[ ] custom format

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/garethng/loggly",
    "name": "logpilot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "loggly,logging,log",
    "author": "Gareth Ng",
    "author_email": "wu.qingzhe@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/16/5d/3287416c54611d5f64a3782bee3376d02fddf994f97748049b39287270f0/logpilot-0.2.1.tar.gz",
    "platform": null,
    "description": "# logpilot\nlogpilot is a project to extend python standard logging to offer customizing ability.\n\n### Install\n```bash\npip install logpilot\n```\n\n### Log format  \n\nwe only support format like this:  \n```bash\n#--------------------------------------------------\n# Log Format\n#--------------------------------------------------\n# %(asctime)s.%(msecs)03d      yyyy-mm-dd HH:MM:SS 2016-01-01 00:00:00.000\n# %(filename)s      \n# %(pathname)s      Full path \n# %(funcName)s      \n# %(levelname)s     \n# %(lineno)d        \n# %(module)s        \n# %(message)s       \n# %(name)s          \n# %(processName)s   \n# %(threadName)s    \n# %(hostname)s      FQDN\n# %(uuid)s          custom uuid \n# %(elapsed)s       (ms)\n%(asctime)s.%(msecs)03d|%(levelname)s|%(name)s|%(filename)s|%(lineno)d|%(module)s|%(funcName)s|%(processName)s|%(threadName)s|%(message)s|%(hostname)s|%(uuid)s|%(elapsed)s\n```\n\n### How to use  \n```python\nfrom logpilot.log import Log\n\nlog = Log.get_logger(__name__)\n\n\nclass Example(object):\n\n    def __init__(self):\n      log.info(msg=\"this is a test for logpilot\", uuid=\"2b24bad1c5df6b4551768fe09ae877b893fc35505847e80f119c395bca27\", elapsed=256)\n```\n\n### example log\n```bash\n2016-11-17 14:35:59|DEBUG|__main__|test2_log.py|11|test2_log|__init__|MainProcess|MainThread|this is a test for logpilot|localhost|2b24bad1c5df6b4551768fe09ae877b893fc35505847e80f119c395bca27|256\n```\n\n### How to set global uuid\n\n```python\nfrom logpilot.log import Log\nlog = Log.get_logger(__name__, uuid='hsdfhkd')\nlog.info(msg=\"this is a test logpilot\", elapsed=8888)\nlog.info(msg='hahah', uuid='5678')\nlog.debug(msg=\"android world\", elapsed=234)\n# notice that uuid also can be override\nlog.error(msg=\"ios world\", uuid='jaj', elapsed=99)\n```\n\n\n### How to change log level\n  \ndefault DEBUG\n\n```python  \nimport logging\nfrom logpilot.log import Log\n\nlog = Log.get_logger('test2222')\nlog.logger.setLevel(logging.INFO)\n\n\nclass Test(object):\n\n    def __init__(self):\n        log.info(msg=\"this is a test logpilot\", hahah='hooooo.', age=10000, fake_key='not valid')\n        \nif __name__ == '__main__':\n    from logpilot.log import Log\n    a = Test()\n    log.debug(msg=\"this is a test logpilot\", hahah='hooooo.', uuid=\"1234567890\")\n```  \n\n### TODO:\n-[ ] custom format\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Common Logger",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/garethng/loggly"
    },
    "split_keywords": [
        "loggly",
        "logging",
        "log"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "364d96f10870cdeb9debd30a1625498a09190756127b7f0509ed85025a9b820d",
                "md5": "ea87fd654b25919d7567e4f482f4fdfc",
                "sha256": "971dcb9377811867891641073e227bddb5f14b14782f7af41d4f0c72149494ee"
            },
            "downloads": -1,
            "filename": "logpilot-0.2.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ea87fd654b25919d7567e4f482f4fdfc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4056,
            "upload_time": "2024-01-05T08:17:58",
            "upload_time_iso_8601": "2024-01-05T08:17:58.907766Z",
            "url": "https://files.pythonhosted.org/packages/36/4d/96f10870cdeb9debd30a1625498a09190756127b7f0509ed85025a9b820d/logpilot-0.2.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "165d3287416c54611d5f64a3782bee3376d02fddf994f97748049b39287270f0",
                "md5": "80ed5c7fd01c71074f82cee1b17057d4",
                "sha256": "21e47db760ce4028f4b0d011677b0ee1684eb32e6e04e398bc7dbfaceab1c3d3"
            },
            "downloads": -1,
            "filename": "logpilot-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "80ed5c7fd01c71074f82cee1b17057d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5311,
            "upload_time": "2024-01-05T08:18:00",
            "upload_time_iso_8601": "2024-01-05T08:18:00.403767Z",
            "url": "https://files.pythonhosted.org/packages/16/5d/3287416c54611d5f64a3782bee3376d02fddf994f97748049b39287270f0/logpilot-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-05 08:18:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "garethng",
    "github_project": "loggly",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "logpilot"
}
        
Elapsed time: 0.67614s