function watchdog_drush_command

8.0.x watchdog.drush.inc watchdog_drush_command()
6.x watchdog.drush.inc watchdog_drush_command()
7.x watchdog.drush.inc watchdog_drush_command()
3.x watchdog.drush.inc watchdog_drush_command()
4.x watchdog.drush.inc watchdog_drush_command()
5.x watchdog.drush.inc watchdog_drush_command()
master watchdog.drush.inc watchdog_drush_command()

Implementation of hook_drush_command().

File

commands/core/watchdog.drush.inc, line 20

Code

function watchdog_drush_command() {
  $items['watchdog-list'] = array(
    'description' => 'Show available message types and severity levels. A prompt will ask for a choice to show watchdog messages.',
    'drupal dependencies' => array('dblog'),
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'var_export',
      'field-labels' => array(
        'wid' => 'ID',
        'type' => 'Type',
        'message' => 'Message',
        'severity' => 'Severity',
        'location' => 'Location',
        'hostname' => 'Hostname',
        'date' => 'Date',
        'username' => 'Username',
      ),
      'fields-default' => array(
        'wid',
        'date',
        'type',
        'severity',
        'message',
      ),
      'column-widths' => array(
        'type' => 8,
        'severity' => 8,
      ),
      'output-data-type' => 'format-table',
    ),
    'aliases' => array('wd-list'),
  );
  $items['watchdog-show'] = array(
    'description' => 'Show watchdog messages.',
    'drupal dependencies' => array('dblog'),
    'arguments' => array(
      'wid' => 'Optional id of a watchdog message to show in detail. If not provided, a listing of most recent 10 messages will be displayed. Alternatively if a string is provided, watchdog messages will be filtered by it.',
    ),
    'options' => array(
      'count' => 'The number of messages to show. Defaults to 10.',
      'severity' => 'Restrict to messages of a given severity level.',
      'type' => 'Restrict to messages of a given type.',
      'tail' => 'Continuously show new watchdog messages until interrupted.',
      'sleep-delay' => 'To be used in conjunction with --tail. This is the number of seconds to wait between each poll to the database. Delay is 1 second by default.',
      'extended' => 'Return extended information about each message.',
    ),
    'examples' => array(
      'drush watchdog-show' => 'Show a listing of most recent 10 messages.',
      'drush watchdog-show 64' => 'Show in detail message with id 64.',
      'drush watchdog-show "cron run succesful"' => 'Show a listing of most recent 10 messages containing the string "cron run succesful".',
      'drush watchdog-show --count=46' => 'Show a listing of most recent 46 messages.',
      'drush watchdog-show --severity=notice' => 'Show a listing of most recent 10 messages with a severity of notice.',
      'drush watchdog-show --type=php' => 'Show a listing of most recent 10 messages of type php.',
      'drush watchdog-show --tail --extended' => 'Show a listing of most recent 10 messages with extended information about each one and continue showing messages as they are registered in the watchdog.',
      'drush watchdog-show --tail --sleep-delay=2' => 'Do a tail of the watchdog with a delay of two seconds between each poll to the database.',
    ),
    'outputformat' => array(
      'default' => 'table',
      'pipe-format' => 'var_export',
      'field-labels' => array(
        'wid' => 'ID',
        'type' => 'Type',
        'message' => 'Message',
        'severity' => 'Severity',
        'location' => 'Location',
        'hostname' => 'Hostname',
        'date' => 'Date',
        'username' => 'Username',
      ),
      'fields-default' => array(
        'wid',
        'date',
        'type',
        'severity',
        'message',
      ),
      'column-widths' => array(
        'type' => 8,
        'severity' => 8,
      ),
      'output-data-type' => 'format-table',
    ),
    'aliases' => array('wd-show', 'ws'),
  );
  $items['watchdog-delete'] = array(
    'description' => 'Delete watchdog messages.',
    'drupal dependencies' => array('dblog'),
    'options' => array(
      'severity' => 'Delete messages of a given severity level.',
      'type' => 'Delete messages of a given type.',
    ),
    'examples' => array(
      'drush watchdog-delete all' => 'Delete all messages.',
      'drush watchdog-delete 64' => 'Delete messages with id 64.',
      'drush watchdog-delete "cron run succesful"' => 'Delete messages containing the string "cron run succesful".',
      'drush watchdog-delete --severity=notice' => 'Delete all messages with a severity of notice.',
      'drush watchdog-delete --type=cron' => 'Delete all messages of type cron.',
    ),
    'aliases' => array('wd-del', 'wd-delete'),
  );
  return $items;
}