1717from .hash import uuid_from_buffer
1818from .plugin import connection_plugins
1919
20- logger = logging .getLogger (__name__ )
20+ logger = logging .getLogger (__name__ . split ( "." )[ 0 ] )
2121query_log_max_length = 300
2222
2323
@@ -187,7 +187,7 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
187187 self .conn_info ["ssl_input" ] = use_tls
188188 self .conn_info ["host_input" ] = host_input
189189 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 ))
191191 self ._conn = None
192192 self ._query_cache = None
193193 connect_host_hook (self )
@@ -341,7 +341,7 @@ def query(
341341 except errors .LostConnectionError :
342342 if not reconnect :
343343 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." )
345345 connect_host_hook (self )
346346 if self ._in_transaction :
347347 self .cancel_transaction ()
@@ -382,15 +382,15 @@ def start_transaction(self):
382382 raise errors .DataJointError ("Nested connections are not supported." )
383383 self .query ("START TRANSACTION WITH CONSISTENT SNAPSHOT" )
384384 self ._in_transaction = True
385- logger .info ("Transaction started" )
385+ logger .debug ("Transaction started" )
386386
387387 def cancel_transaction (self ):
388388 """
389389 Cancels the current transaction and rolls back all changes made during the transaction.
390390 """
391391 self .query ("ROLLBACK" )
392392 self ._in_transaction = False
393- logger .info ("Transaction cancelled. Rolling back ..." )
393+ logger .debug ("Transaction cancelled. Rolling back ..." )
394394
395395 def commit_transaction (self ):
396396 """
@@ -399,7 +399,7 @@ def commit_transaction(self):
399399 """
400400 self .query ("COMMIT" )
401401 self ._in_transaction = False
402- logger .info ("Transaction committed and closed." )
402+ logger .debug ("Transaction committed and closed." )
403403
404404 # -------- context manager for transactions
405405 @property
0 commit comments