One of the improvements in http://drupal.org/project/provision is a flexible logging API we designed, to communicate back to the front end.

The logging infrastructure is modeled on the drupal_set_message functionality, and additionally integrates with those functions, when available, what it does, is allow you to set log messages to be displayed to the user, or communicated to the back end using a serialized string.

Messages are logged by calling (this has been drushified for the example)

  drush_log('error', dt('Something has gone very very wrong'));
  drush_log('warning', dt('There were some issues, but we can work with it'));
  drush_log('notice', dt('You should know something'));

If not being run in the back end, this would print out the error messages immediately as they are logged, but if called from another drush script, it will store all the messages.

I would like to see this integrated with bash colours : http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html , so you can see if things go wrong.

CommentFileSizeAuthor
#4 drush_logging.diff3.68 KBadrian
#3 drush_logging.diff3.68 KBadrian
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adrian’s picture

This code is already fully formed in provision, but needs to be integrated into drush.

mlncn’s picture

What needs to happen in Drush– just take some code from Provision?

adrian’s picture

Status: Active » Needs review
FileSize
3.68 KB

Here is a patch for the logging API.

it differs slightly from the version in provision, and also takes on some of the characteristics of drush_error.

The 'notice' type will not display if you are not in verbose mode, by default all warnings and errors will display.

This also stays logged so it can be retrieved later. (by a calling script for instance).

I have not converted all the drush_error occurrences, because they need to be replaced by another the drush_set_error command, which will in turn call drush_log with the applicable error message.(http://drupal.org/node/212323)

adrian’s picture

FileSize
3.68 KB

Stupid typo in the last patch.

this one actually compiles =).

moshe weitzman’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.