How to sort drush status messages in test scripts?
You can log your debugging messages in database using watchdog
 and you will find the logged message in order at "admin/reports/dtblog"

Updated:
Check the document page, as for [status] , watchdog has $severity parameter to set the status for your message.Following values can be set as status for the logged message.

WATCHDOG_EMERGENCY: Emergency, system is unusable.
WATCHDOG_ALERT: Alert, action must be taken immediately.
WATCHDOG_CRITICAL: Critical conditions.
WATCHDOG_ERROR: Error conditions.
WATCHDOG_WARNING: Warning conditions.
WATCHDOG_NOTICE: (default) Normal but significant conditions.
WATCHDOG_INFO: Informational messages.
WATCHDOG_DEBUG: Debug-level messages.


As a simple example, check this

 watchdog('your_script_name', '!message', array('!message' =&gt; "something_happened"), WATCHDOG_ERROR);


the above will log message when called keeping severity as "error".