Skip to main content

A faster, safer way to log and debug live code.

Project description

ProdWatch

A faster, safer way to log and debug live code.

Installation & Setup

You can install prodwatch using pip:

pip install prodwatch

Prerequisites

  • Python >= 3.13.
  • A live monitoring server (host your own, or use ours).
  • Environment variables:
    • PRODWATCH_API_TOKEN: Authentication for the monitoring server.
    • PRODWATCH_API_URL: Base URL (optional) for the monitoring server (yours or ours).

Basic Usage

from prodwatch import start_prodwatch

# Your application code
def some_function(a, b):
    return a + b

if __name__ == "__main__":
    start_prodwatch()

    # Hover over this function in your editor, and click to turn on logging.
    # ProdWatch will start logging these function calls immediately.
    # Wait a few moments, and you'll start seeing logs.
    # No added logging code, no config changes, no deploy required!
    some_function(4, 2)

Configuration

Environment Variables

Required for ProdWatch Operation

Variable Description Default Required
PRODWATCH_API_TOKEN Authentication token for monitoring server None Yes
PRODWATCH_API_URL Base URL of monitoring server https://getprodwatch.com No

Optional for ProdWatch Internal Logging

These control how ProdWatch logs its own behavior (not your application's logs):

Variable Description Default Required
PRODWATCH_LOG_LEVEL Logging level (DEBUG, INFO, WARNING, ERROR) INFO No
PRODWATCH_LOG_FORMAT Log output format (text, json) text No
PRODWATCH_LOG_FILE Path to log file (enables file logging) None No

ProdWatch Internal Logging Configuration

You can configure logging for ProdWatch itself (as mentioned above, this is not to be confused with the logging ProdWatch does for your code).

Configuration Files

Place a prodwatch_logging.json file in your project root for custom logging setup:

{
  "version": 1,
  "formatters": {
    "standard": {
      "format": "%(asctime)s [%(name)s] [%(levelname)s] %(message)s"
    },
    "json": {
      "()": "prodwatch.logging_config.StructuredFormatter"
    }
  },
  "handlers": {
    "console": {
      "class": "logging.StreamHandler",
      "formatter": "standard"
    },
    "file": {
      "class": "logging.handlers.RotatingFileHandler",
      "filename": "prodwatch.log",
      "formatter": "json",
      "maxBytes": 10485760,
      "backupCount": 5
    }
  },
  "loggers": {
    "prodwatch": {
      "level": "DEBUG",
      "handlers": ["console", "file"]
    }
  }
}

Environment-Based Configuration

  • PRODWATCH_LOG_FORMAT=json enables JSON structured logging
  • PRODWATCH_LOG_FILE=app.log enables file logging with rotation

Server Endpoints

The monitoring server should implement the following endpoints:

  • GET /pending-function-names?process_id={id}: Returns list of functions to monitor.
  • POST /events: Receives monitoring events (process registration, function calls, confirmations).

API Reference

Just One Function!

start_prodwatch()

Initializes and starts ProdWatch.

Behavior:

  • Creates Manager instance with monitoring server URL
  • Checks server connection
  • Starts polling loop in a background thread
  • Listens for requests (from VS Code) to monitor specific functions.
  • Sends function-call data to the monitoring server.

Exception Classes

ProdwatchError

Base exception for all Prodwatch-related errors.

TokenError

Raised when API token is missing or invalid.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prodwatch-0.2.0.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prodwatch-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file prodwatch-0.2.0.tar.gz.

File metadata

  • Download URL: prodwatch-0.2.0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for prodwatch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ef1d259037263127d6b5591ddb0b05506d7035769156203250cd0129a5495ea3
MD5 38972de1e56d42b8208c9c3d6c26a774
BLAKE2b-256 dbc5b0d37e9744862a928c6b0bfac7d119b1559aa9edc7e4af08a1b14c01896a

See more details on using hashes here.

File details

Details for the file prodwatch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: prodwatch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for prodwatch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09a124fa9e2ad60af829e234c019b441267bfa58b1d10b200f8b27ea73fcd591
MD5 cbd43a26c45532bab668ba9c5e786db7
BLAKE2b-256 cba614d5e7d3491373322eac7cf3a3cd457cfc5a4cda951e29c361b782c4891e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page