pytthon logging handler that stores logs in postgresql