Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
â—‹CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
â—‹DOI references
-
â—‹Academic publication links
-
â—‹Committers with academic emails
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (6.4%) to scientific vocabulary
Keywords
Repository
📋 Simple yet robust logging features for Python
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.html
prolog prolog
Tools and convenience methods to simplify and expedite Python logging.
Simple - though opinionated - setup for common use-cases
Extensively and easily configurable via user and local files, as well as environ variables
Comes with full featured formatters and handlers that can also be used in normal logging situations
Usage
basic_config
The easiest way to begin using prolog is to add the following to your application code:
import prolog prolog.basic_config()This will configure the root logger for the default level logging.INFO and set up two handlers: a colorized, console streaming handler, as well as a file handler set to log to the default file - pypro.log - in the main app's directory.
To specify select loggers defined in application or library code, you pass the comma-seperated names of the desired loggers:
prolog.basic_config('myapp,another_app')basic_config accepts the following parameters:
- loggers
The desired loggers to configure; can be either a comma-separated string of logger names, a list of Logger instances, or None for the root logger.
- level
Specify the logging level for all loggers and handlers. Can be either the numeric value or string name for the desired level.
- handlers
The handlers to add to the given loggers; can be a comma-separated string of shortcut names ('stream' or 'file', by default) or a list of Handler instances.
- propagate
Indicates whether each logger instance will be set to propagte.
- reset_handlers
If True, force a reset of all currently configured handlers.
- cfg
The prolog.config.PrologConfig instance to use. If not given, the default will be used (prolog.config.config). For all preceding parameters except for loggers set to None (the default), cfg will be used to determine the appropriate setting.
Examples
Once installed, prolog can be invoked to show configuration settings or sample usage:
$ python -m prolog sample --level=DEBUG basic![]()
Setting colors via environments variables:
$ export PYPROLOG_LEVEL_COLORS='CRITICAL:white,red;ERROR:lightred;DEBUG:lightgray,cyan;*:gray,gray' $ python -m prolog sample --level=DEBUG basic![]()
Develop and testing
$ pip install invoke $ inv develop $ inv testConfiguration
Prolog can be configured via a number of different options:
User-level configuration file, using appdirs to determine the user's configuration directory plus pyprolog/config, which must be a JSON encoded file containing a dictionary overriding any of the defaults listed below
Current working directory configuration file .pyprologrc, also JSON
Environment variables, see below
Manipulation of the default prolog.config.config instance or instantiating your own
Generating a logging.config.dictConfig dict via prolog.config.dict_config
Defaults
LEVEL = 'INFO' SHORT_FMT = "{levelname}:{name} {message}" LONG_FMT = '[{asctime} {name}:{levelname}:{module}:{lineno}] {message}' COLOR_LONG_FMT = '{color}[{asctime} {name}:{levelname}:{module}:{lineno}]{endcolor} {message}' COLOR_SHORT_FMT = '{color}{levelname}:{name}{endcolor} {message}' LEVEL_COLORS = 'DEBUG:magenta;INFO:blue;WARNING:yellow;ERROR:red;CRITICAL:white,red' DATE_FMT = "%Y-%m-%dT%H:%M:%S" STYLE_FMT = '{' HANDLERS = 'stream,file' PROPAGATE = False DISABLE_EXISTING = True RESET_HANDLERS = True STREAM_LEVEL = 'NOTSET' STREAM_FORMATTER = 'color' STREAM_STREAM = 'sys.stderr' FILE_LEVEL = 'NOTSET' FILE_FORMATTER = 'long' FILE_FILENAME = 'pypro.log' FILE_MAX_BYTES = 0 FILE_BACKUP_COUNT = 0Environment
By default, the prolog.config.config instance will load any environment variable begging with PYPROLOG_ and ending with any of the defaults listed above. For instance, to override the default logging level, do the following before executing your application code:
$ export PYPROLOG_LEVEL='DEBUG' $ python myapp.py
Owner
- Name: David A Krauth
- Login: dakrauth
- Kind: user
- Location: Seoul, South Korea
- Website: https://dakrauth.com
- Repositories: 35
- Profile: https://github.com/dakrauth
Python, Django, JS developer.
GitHub Events
Total
- Delete event: 1
- Push event: 1
- Create event: 3
Last Year
- Delete event: 1
- Push event: 1
- Create event: 3
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| David Krauth | d****h@g****m | 22 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 155 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
- Total maintainers: 1
pypi.org: prolog
Simple, robust features for expediting application logging configuration
- Homepage: https://github.com/dakrauth/prolog
- Documentation: https://prolog.readthedocs.io/
- License: MIT License
-
Latest release: 0.3.1
published about 8 years ago
Rankings
Maintainers (1)
Dependencies
- appdirs >=1.4.3
- invoke * test
- logging_tree * test
- pytest * test
- pytest-cov * test