statistics and logging

* statistics record extended messages in SQLite (new fragments col > 0
means extended)
*db_for_plugin_iface now gets the logger