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.3.0.tar.gz (36.7 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.3.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prodwatch-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4aa9601a00750a7aeac249d719bf5a770eb2029d7c301c2a9e8de401046d6470
MD5 d43cf01f9241d6c25b01b9383edeced8
BLAKE2b-256 c2904fa37f11e495def0949b5ed25e900d85f776d9cb75c959b6486b00033626

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prodwatch-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 346bbe0dd6bb790a532b0f81cf5573e94c48399f33d7c77965cb7e41c110d736
MD5 9d54a70054cf0c211b81d30f99fee598
BLAKE2b-256 4268638173b3d654a65288b835b0ed478a6fe0bcc84e5cc32b257bbd116861a8

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