Skip to main content

Configure 🎁 Your 🤗 Python 🐍 Logging 📝

PyPI

Installation

pip install pydantic-loggings

Usage

out of the box

from pydantic_loggings.base import Logging


logger = Logging().get_logger(configure=True)

logger.debug('debug')
logger.info('info')
logger.warning('warning')

# 01-01 00:00:00 DEBUG   debug
# 01-01 00:00:00 INFO    info
# 01-01 00:00:00 WARNING warning

Default Logging

from pydantic_loggings.not_set import Logging


logger = Logging().get_logger(configure=True)

logger.debug('debug')
logger.info('info')
logger.warning('warning')

# warning

Configure from Environment

from pathlib import Path

from pydantic_loggings.not_set import Logging


env_file = Path(__file__).parent / '.env'
logger = Logging(_env_file=env_file).get_logger(configure=True)

logger.debug('debug')
logger.info('info')
logger.warning('warning')

# 01-01 00:00:00 [root]   DEBUG (main.py:11) debug
# 01-01 00:00:00 [root]    INFO (main.py:12) info
# 01-01 00:00:00 [root] WARNING (main.py:13) warning
# .env
log__formatters__my_formatter__datefmt='%m-%d %H:%M:%S'
log__formatters__my_formatter__format='{asctime} [{name}] {levelname:>7} ({filename}:{lineno}) {message}'
log__formatters__my_formatter__style='{'

log__handlers__my_handler__class_='logging.StreamHandler'
log__handlers__my_handler__formatter='my_formatter'

log__loggers__root__level='DEBUG'
log__loggers__root__handlers='["my_handler"]'

# is equivalent to:

# log__formatters__my_formatter='{"datefmt":"%m-%d %H:%M:%S","format":"{asctime} [{name}] {levelname:>7} ({filename}:{lineno}) {message}","style":"{"}'
# log__handlers__my_handler='{"class_":"logging.StreamHandler","formatter":"my_formatter"}'
# log__loggers__root='{"level":"DEBUG","handlers":["my_handler"]}'

# and/or:

# log__formatters='{"my_formatter":{"datefmt":"%m-%d %H:%M:%S","format":"{asctime} [{name}] {levelname:>7} ({filename}:{lineno}) {message}","style":"{"}}'
# log__handlers='{"my_handler":{"class_":"logging.StreamHandler","formatter":"my_formatter"}}'
# log__loggers='{"root":{"level":"DEBUG","handlers":["my_handler"]}}'

Loggings

  • not_set
  • base
  • rich

Metadata

Release files for pydantic-loggings 1.6.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 pydantic-loggings 1.6.1
File Size Uploaded Provenance
pydantic-loggings-1.6.1.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-loggings 1.6.1
File Interpreter ABI Platform
pydantic_loggings-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / pydantic-loggings-1.6.1.tar.gz

Download URL pydantic-loggings-1.6.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2b0b6632a92d3a7a3ed6f362300e0a0c33a6cee76d7b394d3a8686d37b799995
BLAKE2b-256 checksum
How to use checksums
ea494a32facad60f425239696f4c9fa009bf8e5167bf0d80429620d5da99cd5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pydantic_loggings-1.6.1-py3-none-any.whl

Download URL pydantic_loggings-1.6.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
712f874121893412339adbb4fa7f1fd9b15c400189158d9a432bc500a3eaa41c
BLAKE2b-256 checksum
How to use checksums
db5618ad34efb83d7608b0adc6611092a5ee5d4e495b29bd4c2cd8b235be11d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for pydantic-loggings 1.6.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