Arduino master to arduino slave code not working correctly

In the On...Event handlers do required things (read/write msg) first, log later.