Log writing through file object