Skip to main content

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 (see Logger).
  • suppress_app_logs - Set to True to suppress all flask request and werkzug logs.

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

zaidan-0.1.0-py3-none-any.whl (14.6 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