python dev kit
Project description
pydevkit
helpers
logging
This module provides easy logging configuration with command line arguments.
An entrypoint includes
import pydevkit.log.config
then every module does the ussual
import logging
log = logging.getLogger(__name__)
Exrternal configuration
If PYTHON_LOGGING_CONFIG
variable defined, it loads file var points to
and configures logging. If file ends with ".json" dictConfig
is used otherwise
fileConfig
.
Internal configuration
If no external config defined, the module uses internal configuration with following features
-
json or regular formatting
-
colored logs
-
extra log info with
log.info("main text", extra={"extra": {"more": "info"}})
-
argparse options
- log-level
- log-handler
- log-date
- log-color
from pydevkit.argparse import ArgumentParser def main(): p = ArgumentParser(help=__doc__) # FIXME: add your args here Args, UnknownArgs = p.args_resolve()
-
blessing.Terminal wrapper based on
log-color
optionfrom pydevkit.log import term_get def main(): term = term_get() log.warning("try %sred%s string", term.red, term.normal)
argparse
shell
Example
Code run.py
Output
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pydevkit-1.0.0-py3-none-any.whl
(13.6 kB
view hashes)