Skip to main content

Fast access to some simple python logging tricks

Project description

flog

Fast access to some simple python logging tricks

BuildImage

Latest PyPI version Number of PyPI downloads

Installation

Either find flog on PyPI or install it with pip or easy_install

pip install flog
#or
easy_install flog

Basic Usage

Getting a logger: import flog, get a logger with flog.get_logger(__name__)

Logging calls: in and out Get a logger, decorate functions with flog.log_call(<your logger>)

Logging calls with sensitive args (such as passwords): Get a logger, decorate functions with flog.log_sensitive_call(<your logger>)

(new in version 0.1.0) In production environments, you may wish to run with the environment variable FLOG_NOWRAP set truthy. This will make flog.log_call and flog.log_sensitive_call exit as quickly as possible and not attempt to emit DEBUG-level statements. This can also be accomplished by running the interpreter in “optimized” mode (python -O <your entry> or by setting the PYTHONOPTIMIZE environment variable)

(new in version 0.2.0) flog.log_call and flog.log_sensitive_call both now optionally take a callable that will be called with logger-compatible arguments. Suggested uses would be to log at a higher-than-debug level, or piping into another stream handler.

(new in version 0.3.0) CorrelationLoggerAdapter to assist in adding log correlation ids. Use it with flog.CorrelationLoggerAdapter(logger, {"correlation_id": cid}) where cid is some correlation id.

License

This software is hereby released under the MIT License, as seen in the LICENSE file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flog-0.3.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

flog-0.3.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file flog-0.3.1.tar.gz.

File metadata

  • Download URL: flog-0.3.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for flog-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9464bae7fbb9776894926fe7f918569a9a687272efa4787a1e4de7d1902b7cff
MD5 00b57e614fdbfe7ef0d144d6bff7d7b5
BLAKE2b-256 ac9872e58ad1c73eb31b8260753a9929b5e7b1681f57773af18233afcbc4cdce

See more details on using hashes here.

File details

Details for the file flog-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: flog-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for flog-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bcab8792974d8d70ce3c57626c6bd7b652789d69e1d00dd13d0828f440dd51a
MD5 deb7db41bd1f97e29abce94a573e8d64
BLAKE2b-256 c4873bae8771b633679f48a69ab6495433fb6e88fe4481a3b95ba21d46247ca8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page