For logging, you shouldn't use .format, provide a format string and arguments as if for %.  For debug data viewed by developers use %r to get the repr() of the data:

logging.warning("Error doing regex substitution %r on text = %r.\n\nError: %s", c4x_link_base, text, e)


Also, for logging message showing debug data to developers, it's helpful to use the repr() of the data:  {0!r}