Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for zaidan, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size zaidan-0.1.1-py3-none-any.whl (14.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page