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
Comment #1
moshe weitzman commentedgood 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.
Comment #3
dmitrig01 commentedYoung's response: "So I'm leaving
features_log()in for now, in particular becausedrupal_set_message('foo', 'status')doesn't map to thesuccesscase ofdrush_log(). This makes it hard to usedrupal_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.
Comment #4
moshe weitzman commentedI fixed that that 'status' bug just a week ago or so. Will be in next drush release.
Comment #6
infojunkieSorry 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.
Comment #7
moshe weitzman commentedI agree. Fixed as suggested.