Add diagnostics

At request of a customer. Mainly copied from twitter-search-tool.