Logging emits to pgsql database