lib/log: Always flush after writing logs