flush stdout for logging