diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 8f298f58..8b93b3b6 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import struct +import logging from distutils.version import LooseVersion import pymysql @@ -144,7 +145,8 @@ def __init__(self, connection_settings, server_id, is_mariadb=False, annotate_rows_event=False, ignore_decode_errors=False, - verify_checksum=False,): + verify_checksum=False, + enable_logging=True,): """ Attributes: ctl_connection_settings: Connection settings for cluster holding @@ -187,6 +189,8 @@ def __init__(self, connection_settings, server_id, ignore_decode_errors: If true, any decode errors encountered when reading column data will be ignored. verify_checksum: If true, verify events read from the binary log by examining checksums. + enable_logging: When set to True, logs various details helpful for debugging and monitoring + When set to False, logging is disabled to enhance performance. """ self.__connection_settings = connection_settings @@ -228,6 +232,8 @@ def __init__(self, connection_settings, server_id, self.skip_to_timestamp = skip_to_timestamp self.is_mariadb = is_mariadb self.__annotate_rows_event = annotate_rows_event + if enable_logging: + self.__log_valid_parameters() if end_log_pos: self.is_past_end_log_pos = False @@ -368,9 +374,11 @@ def __connect_to_stream(self): if not self.__blocking: flags |= 0x01 # BINLOG_DUMP_NON_BLOCK + prelude += struct.pack('