Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Inspect

50 sites Security covered Drupal 9–11
View on drupal.org

This module provides tools for logging and inspecting variables and stack traces, with features designed for safe use in production. It offers formatted output, handles sensitive data like passwords by hiding them, and includes graceful degradation for large data structures or long execution times. The module also allows for configuration of logging targets and control over user permissions for viewing inspections.

Log instructive and well formatted variable dumps and deep stack traces.

Inspect variables and stack traces, and get better error handling

  • analyzes all kinds of variables, safely
  • provides deep back traces and error traces

Doesn't show, doesn't fail - applicable in production

  • Inspect always hides the value of object/array buckets keyed 'pass' and 'password'
  • doesn't fail on dumping $GLOBALS (~ objects/arrays having self-referring values)
  • doesn't fail on dumping large data structures, degrades gracefully*

* Inspectors and tracers stop before producing overly long output. And abort if time is closing in to PHP's maximum execution time.

D9/10 5.x

Simple usage

\Drupal::service('inspect.inspect')->variable($subject)->log('debug', 'Message prefix');
\Drupal::service('inspect.inspect')->trace($throwableOrNull)->log();

Works with Grafana and database log viewers

The settings form makes it easy to configure against file and database logging, respectively.

Documentation

Uses generic Inspect library

Depends on SimpleComplex Inspect, which depends on nothing.

Requirements

PHP ^8.1

D7 6.x

Tidy and manageable dump output

  • expansible/collapsible branches, buttons for displaying
    all descendants vs. immediate children
  • exhibits variable key paths, like
    array['conf']['language_default']->language

Includes powerful frontend (Javascript) inspector

  • inspect variables; and get full error stack tracing (except for IE)
  • inspect jQuery events
  • log frontend inspections and errors to the backend log

Don't worry anymore...

about forgotten var_dump()s and print_r()s after development and debugging sessions.
If you've set user role permissions sensibly: the ordinary site visitor will never see a dump.

* Inspectors and tracers stop - and do a second attempt using less depth+more truncation - when producing overly long output. And they abort if time is closing in to PHP's maximum execution time.

User/permissions suggestions

Manage who gets to see and log inspections via the module's user role permissions.

Direct inspection

  1. create 'tester' role
  2. allow 'tester's to log inspections/traces
  3. create user having the 'tester' role as well as the role relevant for the scenario you want to investigate (anonymous or authenticated user, or some dedicated user role)
  4. test the relevant pages/features, and check screen outputs or Recent log messages

Indirect inspection - gather information during users' visits

  1. allow the appropriate role to log inspections/traces
  2. do something else, for minutes/hours/days
  3. revoke the role's inspection permission (prevent log flooding)
  4. check Recent log messages and study the inspections gathered during real life use of your site

Sponsorship

Inspect version 7.x-5.0 was sponsored by Københavns Kommune, Koncernservice (Copenhagen Municipality, Corporate Services).

Related modules

Requirements

PHP 5.3+

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
5.0.1 Stable 9–11 Dec 7, 2024