Florian has pointed out that logger code suffers from the same problem
as the main code.  So first of all don't forget to subtract the amount
of what's already read from the total length; secondly correct the
condition to check partial read.