Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

LGP

Security covered Under active development 3 sites

LGP provides developers with a set of lightweight debugging tools to log messages and variables without impacting performance. It offers an alternative to other debugging modules and integrates with Drush for command-line debugging.

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.

Drupal 9–10 · not 11

Ask your assistant about LGP

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
2
Tracked since
Aug 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
2.0.0 Stable 9–10 Aug 2, 2023
2.0.x-dev Dev 9–10 Aug 2, 2023