Common utilities for the Zaidan system.
Project description
Zaidan utilities (python)
Zaidan common utility classes/functions for the Zaidan system in python.
Exports
Classes/functions exported by zaidan
(PyPi package).
Logger
(base class)
A simple logger class that outputs a standardized JSON format.
Constructor
def __init__(self, name: str, level: str) -> Logger
Create a new logger. Provide a name
for the underlying logging.logger
instance, and a level, for which messages below that level will be ignored.
Accepted levels are (correspond to levels from standard library logging
module):
"debug"
- More verbose, specific state information."info"
- General, normal-operation information."warn"
- Warnings about extreme cases, etc."error"
- Standard errors.
No levels less than "debug" or higher than "error" (critical, etc.) are supported at this time.
logger.debug
def debug(self, message: str, extra: object) -> None
Log an debug
level message. Currently, extra
fields must be provided, along with a message
string.
logger.info
def info(self, message: str, extra: object) -> None
Log an info
level message. Currently, extra
fields must be provided, along with a message
string.
logger.warn
def warn(self, message: str, extra: object) -> None
Log an warn
level message. Currently, extra
fields must be provided, along with a message
string.
logger.error
def error(self, message: str, extra: object) -> None
Log an error
level message. Currently, extra
fields must be provided, along with a message
string.
FlaskLogger(Logger)
For use with Flask web-applications. Extends the Logger
class, so all log methods are the same.
Constructor
def __init__(self, app: flask.App, name: str, level: str, suppress_app_logs: bool) -> FlaskLogger
Create a new Flask logger. Required parameters:
app
- The Flask application instance.name
- The name of the application or logger.level
- Log level (seeLogger
).suppress_app_logs
- Set toTrue
to suppress all flask request and werkzug logs.
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 Distributions
Built Distribution
File details
Details for the file zaidan-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: zaidan-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f02f69cac751361de0d987034f9275d6dbff0f197999c6685153ccff70633c6c
|
|
MD5 |
bd54c85d103ea76a3d4c19522d4a102b
|
|
BLAKE2b-256 |
33faf1d6033f8b1b5767a3211c9971a15c018f857a3c163a58e8f5d6df480349
|