If you have whitespace between quotation marks or apostrophes, it gets replaced with one space and thus the logged SQL statement becomes deceptive as it isn't the same that gets executed.
For example during logging
SELECT x FROM y WHERE z = ' ';
will become
SELECT x FROM y WHERE z = ' ';
The method could be modified to use a regular expression that leaves such whitespace intact.