Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Inspect

48 sites Security covered
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+

Activity

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

Releases

Version Type Release date
5.0.1 Stable Dec 7, 2024