In features and feeds module, we provide functionality that is available from both the command line and from the browser (I'm sure other modules do this too). Since these modules both have pluggable systems, and things can always go wrong, we want a way to report errors back to the user, in an environment-agnostic manner.

For features, I've implemented it in a patch - http://drupal.org/files/issues/features_logging_0.patch - with a function features_log, but I don't think this is the best solution, since, for example, it's needed for feeds as well, so it would need to be reimplemented there.

Instead, I think the best solution would be to have something in core. Since we can't do that, I think we need to have something in drush. Specifically, it would be awesome if we could print out any messages that have been set with drupal_set_message at the end of a command being run. That way, to show errors environment-agnostically, someone can just call drupal_set_message.

What do you (drush maintainers) think?

Comments

moshe weitzman’s picture

Category: task » support
Status: Active » Fixed

good idea. drush already does that :)

turn on --verbose and --debug to see any you might be missing ... grep for drupal_get_messages() in drush. its in _drush_log_drupal_messages() which runs at end of each request.

Status: Fixed » Closed (fixed)

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

dmitrig01’s picture

Status: Closed (fixed) » Active

Young's response: "So I'm leaving features_log() in for now, in particular because drupal_set_message('foo', 'status') doesn't map to the success case of drush_log(). This makes it hard to use drupal_set_message() to display pertinent information to drush users when it's not an error or warning."

Not sure if this needs a fix or what.

moshe weitzman’s picture

Status: Active » Fixed

I fixed that that 'status' bug just a week ago or so. Will be in next drush release.

Status: Fixed » Closed (fixed)

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

infojunkie’s picture

Component: Code » PM (dl, en, up ...)
Status: Closed (fixed) » Active

Sorry to reopen this, but I think drupal_set_message() with type = 'status' is still not mapped correctly. When this status type is used, it means that the module wants to show a success message to the user. However, Drush interprets it as an optional message to be shown only in verbose mode - which is not the case. IMO 'status' should map to 'ok'.

Thanks for your consideration.

moshe weitzman’s picture

Status: Active » Fixed

I agree. Fixed as suggested.

Status: Fixed » Closed (fixed)

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