Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def log_db_connection(self, name, db_config):
host = getattr(db_config, 'host', None) or '_' # use "_" for both missing attr or None value cases
port = getattr(db_config, 'port', None) or '_'
user = getattr(db_config, 'username', None) or '_'
database = getattr(db_config, 'database', None) or '_'
config.logger.debug("[{}]: database connection {}@{}:{}/{}".format(name, user, host, port, database))
def watermark(self):
return "/*%s | %s */" % (config.WATERMARK, self.stack)