# cool-RR/PySnooper

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/cool-rr-pysnooper).**

16,604 stars · 959 forks · Python · mit

## Links

- GitHub: https://github.com/cool-RR/PySnooper
- awesome-repositories: https://awesome-repositories.com/repository/cool-rr-pysnooper.md

## Topics

`debug` `debugger` `introspection` `logging` `python`

## Description

PySnooper is a diagnostic library for Python that tracks variable values and execution flow to provide a detailed history of program state. By applying decorators to functions, generators, or classes, it logs line-by-line execution and state changes without requiring manual print statements.

The tool distinguishes itself through its ability to monitor nested function calls and concurrent operations in multi-threaded applications. It captures execution context by accessing the current stack frame, allowing for the inspection of local variables and the evaluation of arbitrary expressions during runtime.

The library supports extensive customization of diagnostic output, including the ability to redirect logs to files, streams, or custom destinations. It provides granular control over tracing, enabling users to filter variable contents, adjust output formatting, and manage monitoring scope through environment variables or direct code annotations.

## Tags

### Programming Languages & Runtimes

- [Diagnostic](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/decorators/diagnostic.md) — Enables granular tracing of functions, generators, or classes by applying simple decorators to existing source code.
- [Tracing Debuggers](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/dynamic-scripting-languages/python/tracing-debuggers.md) — Traces line-by-line execution and variable state changes in Python functions to identify logic errors without manual print statements.
- [Thread-Aware Tracers](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/thread-aware-tracers.md) — Captures and attaches unique identifiers to trace events to maintain visibility across concurrent operations.
- [Concurrent Execution Monitors](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/concurrent-execution-monitors.md) — Tracks concurrent operations in multi-threaded applications by annotating execution logs with thread identifiers.

### System Administration & Monitoring

- [Decorator-Based Instrumentation](https://awesome-repositories.com/f/system-administration-monitoring/decorator-based-instrumentation.md) — Uses function decorators to dynamically inject monitoring logic into the execution context for line-by-line tracing.
- [Execution Tracing](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/execution-tracing-analysis/execution-tracing.md) — Logs line-by-line execution and local variable changes to provide a detailed history of program state. ([source](https://github.com/cool-RR/PySnooper#readme))
- [Execution Tracing](https://awesome-repositories.com/f/system-administration-monitoring/execution-tracing.md) — Utilizes the built-in system for intercepting line-by-line execution to capture state changes without modifying source code.
- [Tracing Control Interfaces](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/execution-tracing-analysis/execution-tracing/tracing-control-interfaces.md) — Enables or disables tracing globally or selectively through environment variables and code annotations. ([source](https://github.com/cool-RR/PySnooper/blob/master/ADVANCED_USAGE.md))
- [Trace Customizers](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/execution-tracing-analysis/execution-tracing/trace-customizers.md) — Adjusts output formatting, variable length limits, and custom string representations for complex objects. ([source](https://github.com/cool-RR/PySnooper/blob/master/ADVANCED_USAGE.md))
- [Debug Logging Management](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/log-management-systems/debug-logging-management.md) — Sends execution traces to custom destinations when standard error output is insufficient. ([source](https://github.com/cool-RR/PySnooper#readme))
- [Custom Log Writers](https://awesome-repositories.com/f/system-administration-monitoring/system-logging/custom-log-writers.md) — Allows redirecting diagnostic trace output to custom files, streams, or destinations instead of standard error.

### Testing & Quality Assurance

- [Execution Tracers](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/execution-tracers.md) — Logs line-by-line code execution and local variable changes to provide a detailed history of program state.

### Development Tools & Productivity

- [Diagnostic Execution Tracers](https://awesome-repositories.com/f/development-tools-productivity/diagnostic-execution-tracers.md) — Tracks variable values and execution flow across nested function calls and concurrent threads in Python applications.
- [Variable Inspection Tools](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/debugging-and-inspection-tools/intermediate-output-inspection/variable-inspection-tools.md) — Expands objects, lists, or dictionaries to display internal attributes, keys, or indices during execution. ([source](https://github.com/cool-RR/PySnooper/blob/master/ADVANCED_USAGE.md))
- [Stack Frame Inspectors](https://awesome-repositories.com/f/development-tools-productivity/dynamic-variable-evaluators/stack-frame-inspectors.md) — Accesses the current execution stack to extract local variable values and evaluate expressions during runtime.
- [Thread-Annotated Tracers](https://awesome-repositories.com/f/development-tools-productivity/thread-managers/thread-annotated-tracers.md) — Annotates trace output with thread identifiers to distinguish between concurrent operations in multi-threaded applications. ([source](https://github.com/cool-RR/PySnooper/blob/master/ADVANCED_USAGE.md))
- [Recursive Call Traversers](https://awesome-repositories.com/f/development-tools-productivity/call-stack-navigators/recursive-call-traversers.md) — Monitors nested function invocations by propagating tracing state through the call stack.
- [Stream Redirection](https://awesome-repositories.com/f/development-tools-productivity/cli-output-controllers/stream-redirection.md) — Redirects diagnostic output to specified files, streams, or custom destinations. ([source](https://github.com/cool-RR/PySnooper/blob/master/README.md))
- [Diagnostic Log Routers](https://awesome-repositories.com/f/development-tools-productivity/cli-output-controllers/stream-redirection/diagnostic-log-routers.md) — Routes diagnostic output through configurable buffers to support writing trace data to files or custom destinations.
- [Execution Monitors](https://awesome-repositories.com/f/development-tools-productivity/execution-monitors.md) — Tracks the values of specific variables or object attributes that are not local to the current scope. ([source](https://github.com/cool-RR/PySnooper/blob/master/README.md))

### User Interface & Experience

- [Runtime](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/template-engines/control-flow-directives/expression-evaluators/runtime.md) — Evaluates and records the values of specific expressions or variables that exist outside the local scope. ([source](https://github.com/cool-RR/PySnooper#readme))

### DevOps & Infrastructure

- [Runtime State Inspectors](https://awesome-repositories.com/f/devops-infrastructure/automation-orchestration/task-execution-frameworks/state-inspection-tools/runtime-state-inspectors.md) — Provides runtime inspection of object attributes and dictionary values to help developers understand how data structures evolve during execution.
