Skip to main content

logpilot

logpilot is a project to extend python standard logging to offer customizing ability.

Install

pip install logpilot

Log format

we only support format like this:

#--------------------------------------------------
# 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

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

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

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

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

Metadata

Release files for logpilot 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logpilot 0.2.1
File Size Uploaded Provenance Actions
logpilot-0.2.1.tar.gz 5.3 kB Without provenance Details for logpilot-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logpilot 0.2.1
File Interpreter ABI Platform Actions
logpilot-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for logpilot-0.2.1-py2.py3-none-any.whl

Total release size: 9.4 kB

Release files / logpilot-0.2.1.tar.gz

Download URL logpilot-0.2.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
21e47db760ce4028f4b0d011677b0ee1684eb32e6e04e398bc7dbfaceab1c3d3
BLAKE2b-256 checksum
How to use checksums
165d3287416c54611d5f64a3782bee3376d02fddf994f97748049b39287270f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / logpilot-0.2.1-py2.py3-none-any.whl

Download URL logpilot-0.2.1-py2.py3-none-any.whl
Size 4.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
971dcb9377811867891641073e227bddb5f14b14782f7af41d4f0c72149494ee
BLAKE2b-256 checksum
How to use checksums
364d96f10870cdeb9debd30a1625498a09190756127b7f0509ed85025a9b820d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for logpilot 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page