LGP (Lazy Guinea Pig) is a set of debugging tools designed for Drupal developers who need a straightforward and efficient way to log debug messages.

Features

LGP offers a variety of tools to help you debug Drupal more effectively:

  • Temporary Debug File: Logs debug messages to a temporary file called the LGP file.
  • Low Memory Usage: Operates with a minimal memory footprint, avoiding database bottlenecks.
  • Alternative to Devel: Useful when Devel's dsm() doesn't work or when an alternative debug log is needed, such as when debugging services.module or during hook_init().
  • Centralized Debugging: Shares the LGP file across Drupal installations that use the same temporary directory.

Functions

LGP includes the following functions to log various types of debug information:

  • lgp_print($message): Logs a message to the LGP file.
  • Lazy Print: lp($var, $keys_only = FALSE): Logs a variable in print_r format. Optionally logs only the keys if passed an array. Alias: lfp().
  • Lazy Dump: ld($var): Logs a variable in var_dump format. Alias: lfd().
  • Lazy Export: lx($var): Logs a variable in var_export format. Alias: lfx().
  • Lazy Backtrace: lbt($ignore_args = TRUE): Logs the backtrace without function arguments by default. Alias: lfbt(). See debug_backtrace.

Drush Integration

LGP integrates with Drush, providing additional tools for command-line debugging:

  • lgp-console: A console watcher that shows logs of functions lfp(), lfd(), and lfx(). Alias: lgc.

    Usage:

    $ drush lgc # Linux and macOS
    

    Windows Users: You'll need UnixCore tail or Cygwin to watch the lgp.log file.

  • Drush Debug Functions: Print the output of debug functions to stdout (only available from "drush ev"):

    _lp() or _lfp() for lp()

    _ld() or _lfd() for ld()

    _lx() or _lfx() for lx()

    _lbt() for lbt()

    Example:

    $ drush ev "_lp(user_load(1))"

Locating the lgp.log File

You can find the path to the lgp.log file in the Status report.

Supporting organizations: 
Maintainer sponsorship

Project information

Releases