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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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