title: How can I log all outgoing SQL statements from Go / MySQL?
body: <p>I'm using a non-framework Go stack with <a href="https://github.com/jmoiron/sqlx" rel="noreferrer">sqlx</a>, and <a href="https://github.com/go-sql-driver/mysql" rel="noreferrer">MySQL</a> for a web project. </p>
  
  <p>I would like to log all outgoing SQL statements for debugging. Is it possible to do this? Hopefully looking to get output like this (copied from a Rails project):</p>
  
  <pre><code>  User Load (94.4ms)  SELECT `users`.* FROM `users` WHERE `users`.`login` = 'bondnewyork' LIMIT 1
    User Load (16.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`login` = 'mkovarik' LIMIT 1
    User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`login` = 'mkovarik' LIMIT 1
    User Load (0.3ms)  SELECT `users`.* FROM `users` ORDER BY `users`.`id` DESC LIMIT 1
    User Load (0.4ms)  SELECT `users`.* FROM `users` ORDER BY `users`.`id` DESC LIMIT 1
  </code></pre>