LGP stands for "Lazy Guinea Pig."

Drupal debugging tools for slackers. Are you one too?

Features

Currently, LGP provides a set of tools to debug Drupal, including:

  • Writing the given debug message to a temporary file, the LGP file.
  • Having a low memory footprint, skipping the Database bottleneck.
  • Being useful where Devel's dsm() does not work or when you need an alternative debug log. For example, while debugging services.module (instead of Services log) or during hook_init().
  • Having a centralized debug file; the LGP file is shared by Drupal installations that use the same temporary directory.

Functions

LGP implements the following functions:

  • lgp_print($message): Logs $message to the LGP file.
  • Lazy Print: lp($var, $keys_only = FALSE): Logs the variable to the LGP file in print_r format. Alternatively, it prints keys only (if passed an array as an argument). Alias: lfp().
  • Lazy Dump: ld($var): Logs $var to the LGP file in var_dump format. Alias: lfd().
  • Lazy Export: lx($var): Logs $var to the LGP file in var_export format. Alias: lfx().
  • Lazy Backtrace: lbt($ignore_args = TRUE): Logs the backtrace to the LGP file, without function arguments (default behavior, see debug_backtrace).

Drush Integration

LGP provides the following for Drush:

  • lgp-console: Console watcher. Shows a log of functions: lfp(), lfd(), and lfx().
    Alias: lgc
    Usage:
    $ drush lgc # Linux and macOS
    

    Note for **Windows users**: you will need UnixCore tail or Cygwin to watch the lgp.log file.

  • Print the output of debug functions to stdout (available only from "drush ev"):
    _lp() or _lfp() see lp()
    _ld() or _lfd() see ld()
    _lx() or _lfx() see lx()
    _lbt() see lbt()

    Example:

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

Where is the lgp.log file?

Visit the Status report; there you will find the file path to lgp.log.

Supporting organizations: 
Maintainer sponsorship

Project information

Releases