Add a “view debug log” link in the WP admin bar

Unless otherwise specified, all code here is licensed GPLv2