Example of % operator :
"Hello %s" % text
But , The above code doesn’t always work. Suppose we text happens to be (1,1,1) then it will show a TypeEror, in such cases you need to modify the code a little:
"some debug info: %s" % (text,)
.format doesn't have such problems so we prefer using it most of the time .As per your second question, string formatting happens when the string formatting expression is evaluated. In your example, "some debug info:" will be first evaluated and then passed to the log.debug().