Skip to main content

A Python logging helper

Project description

sharklog

Python logging helper.

PyPI License PyPI Version PyPI Downloads

Quick Start

  • Install sharklog:
python -m pip install sharklog
  • Use in standalone script:
# standalone.py
from sharklog import logging

logging.init(debug=True)
logging.debug("debug message")
logging.info("info message")
logging.warning("warning message")
logging.error("error message")
  • Use in module:
# submodule.py which is placed under package `parent`
from sharklog import logging

logger = logging.getLogger()    # the logger name will be `parent.submodule`

logger.debug("debug message")
logger.info("info message")
logger.warning("warning message")
logger.error("error message")

If you already using builtin logging module, you can use sharklog as a drop-in replacement.

Just change import logging into from sharklog import logging. Then you can use logging as usual:

# module_name.py
from sharklog import logging

# these log messages will be prefixed with the logger name `xxxpackage.xxmodule.module_name`
logging.debug("debug message")
logging.info("info message")
logging.warning("warning message")
logging.error("error message")

Usage in Package Development

# parent/__init__.py
from sharklog import logging

logging.getLogger().addHandler(logging.NullHandler())

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

sharklog-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

sharklog-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file sharklog-0.0.2.tar.gz.

File metadata

  • Download URL: sharklog-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for sharklog-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d5d141b0896a1257b44aaa6959b2fe6b126cbcbf1be950c4285d78286f57974f
MD5 81a56911bd6acffb21de08a42966f8f5
BLAKE2b-256 166d7a2042c8e7d6d3bec888c39ddbe4f5128ce8f21df0c9e6f7d2d7c2a68861

See more details on using hashes here.

File details

Details for the file sharklog-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sharklog-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for sharklog-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3bfb413abd2862e44ec632ac050f7039280fbf86cc5d8d4a9b27a0401367004a
MD5 abbf625a7a4f73b0a7963daac75653f6
BLAKE2b-256 64e37b0537d4465e206cde2b8d23dfde491dd4246980a5abe8a4f1d70818600d

See more details on using hashes here.

Supported by

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