[FIX] logging PostgreSQLHandler: expand message + use contextmanagers to handle exceptions and cursor