READY_W = Ready.W
READY_RW = Ready.RW
-logger = logging.getLogger(__name__)
+logger = logging.getLogger("psycopg")
def _connect(conninfo: str, *, timeout: float = 0.0) -> PQGenConn[PGconn]:
# $ PSYCOPG_IMPL=python python
# >>> import logging
# >>> logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
+ # >>> logging.getLogger("psycopg").setLevel(logging.DEBUG)
conn = pq.PGconn.connect_start(conninfo.encode())
logger.debug("connection started: %s", conn)
if timeout:
deadline = monotonic() + timeout
+ logger.debug("connection started: %s", conn)
while True:
if conn_status == libpq.CONNECTION_BAD:
encoding = conninfo_encoding(conninfo)
with nogil:
poll_status = libpq.PQconnectPoll(pgconn_ptr)
+ logger.debug("connection polled: %s", conn)
if poll_status == libpq.PGRES_POLLING_READING \
or poll_status == libpq.PGRES_POLLING_WRITING: