Skip to main content

python-logsy

A standardised logging configuration I use for a few things.

Quickstart

  1. Install this package with optional extras:

    pip install python-logsy[fluent,sentry]
    
  2. Import and configure. This package has three logging handlers available in the default configuration. All are relatively self-explanatory except that the fluent handler logs to a Fluentd or Fluent Bit instance and requires the fluent dependencies to be installed via the optional extras. Furthermore, the file handler uses logging.handlers.RotatingFileHandler. Log files will rollover at 100 megabytes when using the file handler.

    import logging
    
    import logsy
    
    config = {
        'loggers': {
            'app': {
                'handlers': ['console', 'fluent', 'file'],
                'level': 'INFO',
                'propagate': True,
            },
        },
    }
    logsy.init(
        config,
        tag='apps.myapp', # Also used as the Fluent tag (routing)
        fluent_host='localhost',
        environment='production',
        release='2.1.1-beta',
    )
    
  3. A complete example of init; including setup for Sentry:

    logsy.init(
        config,
        tag='apps.myapp', # Also used as the Fluent tag (routing)
        replace_config=False,
        fluent_host='localhost',
        fluent_port=24224, # default
        async_fluent=True, # default
        environment='debug',
        debug=True, # default is False
        release='2.1.1-beta',
        level=logging.INFO, # default
        sentry_config={
            'dsn': 'fake-dsn-string',
            'traces_sample_rate': 1.0, # default
        },
    )
    
  4. Log as per usual:

    import logging
    
    logger = logging.getLogger(__name__)
    logger.info('Testing')
    
  5. If needed, replace the default logging config with your own:

    config = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {}, # incomplete
        'handlers': {}, # incomplete
    }
    logsy.init(
        config,
        replace_config=True,
        tag='apps.myapp',
        fluent_host='localhost',
        fluent_port=24224, # default
        environment='debug',
        debug=True, # default is False
        release='2.1.1-beta',
        level=logging.INFO, # default
    )
    

Metadata

Release files for python-logsy 0.3.0

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

Source distribution (sdist)

Source distribution for python-logsy 0.3.0
File Size Uploaded Provenance Actions
python_logsy-0.3.0.tar.gz 5.0 kB Without provenance Details for python_logsy-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-logsy 0.3.0
File Interpreter ABI Platform Actions
python_logsy-0.3.0-py3-none-any.whl Python 3 none any Details for python_logsy-0.3.0-py3-none-any.whl

Total release size: 9.9 kB

Release files / python_logsy-0.3.0.tar.gz

Download URL python_logsy-0.3.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a8b54558a93040904814337a717dca95d1a76b09fe9b2061e6e1cb0d13aaaa9a
BLAKE2b-256 checksum
How to use checksums
3cdc43a2e466d04fe62427e2a5675e75159b4da86d20c0405e195d9d760f8f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / python_logsy-0.3.0-py3-none-any.whl

Download URL python_logsy-0.3.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2471dfd4607686dbfa84b68babab5326bcf2a487a6ee008f1dc6117c97d9ec94
BLAKE2b-256 checksum
How to use checksums
3d76c27234c714ef6ddc13ae3ddefb20a15633b2d2aa5c9080055ee561c7c18b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for python-logsy 0.3.0

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