Shared code logic in the project Thoth.
Project description
A library used in project Thoth. It’s aim is to provide core utilities for logger setup, manipulation with datetimes and similar handy helpers.
Installation
This project is released on PyPI, so the latest release can be installed via pip or Pipenv as shown below:
pipenv install thoth-common
This library will automatically discover installed packages and enable Sentry integrations if you use Flask, SQLAlchemy or AIOHTTP. An exception is for Flask applications, that need to explicitly install sentry-sdk[flask] due to integrations dependencies.
Logging setup
To setup a logger in any of Thoth’s component (component that are namespaced with thoth), you can simply set an environment variable. The name of environment variable is constructed from module name. Let’s say you want to debug thoth.adviser.pipeline module, in that case you can set environment variable:
THOTH_LOG_ADVISER_PIPELINE=DEBUG which will cause loggers thoth.adviser.pipeline to be set to DEBUG mode. See log-levels documentation for more info. If a module has underscore in its name, replace it with double underscore in the environment variable name.
To setup a logger that is not introduced by a Thoth’s component, you can set THOTH_ADJUST_LOGGING environment variable. The format of this environment variable THOTH_ADJUST_LOGGING is a comma separated list where each entry is made out of a logger name and a corresponding log-level (“DEBUG”, “INFO”, “WARNING”, “ERROR” as for standard Python’s logging). These two are delimited by a colon, an example:
THOTH_ADJUST_LOGGING="flask:WARNING,alembic.migrations:ERROR"
Ignoring reports from a logger
In some cases it’s expected to turn off reporting of some logger to Sentry. You can provide THOTH_SENTRY_IGNORE_LOGGER environment variable which holds a comma separated list of loggers that should be ignored when reporting errors to Sentry:
THOTH_SENTRY_IGNORE_LOGGER="thoth.adviser.resolver,thoth.adviser.run"
This is helpful if you want to report errors to users but not to Thoth application itself.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file thoth-common-0.9.22.tar.gz
.
File metadata
- Download URL: thoth-common-0.9.22.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/36.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18958b36aa6060ed8f14cce16d39d696b7db8b78e7e76e46c68d0c584a876b4 |
|
MD5 | 7561aa37c5cd7b97612ef5a9f61d52f2 |
|
BLAKE2b-256 | 3240ac34f5f679c56813305fc42d8f7a03a998b45d7ad29c8ebf0b184e4714a3 |
File details
Details for the file thoth_common-0.9.22-py3-none-any.whl
.
File metadata
- Download URL: thoth_common-0.9.22-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/36.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8d9f7bb4f1457ae004f3fdfe27ad87725e0c167cc4ece3536d196ae47171875 |
|
MD5 | 98772b38567f5e0e59c20956a3a7d771 |
|
BLAKE2b-256 | 49cfc569f172f1125681c08f08c904fb592528299758c3565a4cd721547baa84 |