17
17
from .hash import uuid_from_buffer
18
18
from .plugin import connection_plugins
19
19
20
- logger = logging .getLogger (__name__ )
20
+ logger = logging .getLogger (__name__ . split ( "." )[ 0 ] )
21
21
query_log_max_length = 300
22
22
23
23
@@ -187,7 +187,7 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
187
187
self .conn_info ["ssl_input" ] = use_tls
188
188
self .conn_info ["host_input" ] = host_input
189
189
self .init_fun = init_fun
190
- print ("Connecting {user}@{host}:{port}" .format (** self .conn_info ))
190
+ logger . info ("Connecting {user}@{host}:{port}" .format (** self .conn_info ))
191
191
self ._conn = None
192
192
self ._query_cache = None
193
193
connect_host_hook (self )
@@ -341,7 +341,7 @@ def query(
341
341
except errors .LostConnectionError :
342
342
if not reconnect :
343
343
raise
344
- warnings . warn ("MySQL server has gone away. Reconnecting to the server." )
344
+ logger . warning ("MySQL server has gone away. Reconnecting to the server." )
345
345
connect_host_hook (self )
346
346
if self ._in_transaction :
347
347
self .cancel_transaction ()
@@ -382,15 +382,15 @@ def start_transaction(self):
382
382
raise errors .DataJointError ("Nested connections are not supported." )
383
383
self .query ("START TRANSACTION WITH CONSISTENT SNAPSHOT" )
384
384
self ._in_transaction = True
385
- logger .info ("Transaction started" )
385
+ logger .debug ("Transaction started" )
386
386
387
387
def cancel_transaction (self ):
388
388
"""
389
389
Cancels the current transaction and rolls back all changes made during the transaction.
390
390
"""
391
391
self .query ("ROLLBACK" )
392
392
self ._in_transaction = False
393
- logger .info ("Transaction cancelled. Rolling back ..." )
393
+ logger .debug ("Transaction cancelled. Rolling back ..." )
394
394
395
395
def commit_transaction (self ):
396
396
"""
@@ -399,7 +399,7 @@ def commit_transaction(self):
399
399
"""
400
400
self .query ("COMMIT" )
401
401
self ._in_transaction = False
402
- logger .info ("Transaction committed and closed." )
402
+ logger .debug ("Transaction committed and closed." )
403
403
404
404
# -------- context manager for transactions
405
405
@property
0 commit comments