Currently I do not think there is a way to capture a User logout in a precise way. The security Log might have it as 'Session Expired' depending on the log settings. and I don't think you can set a subscription on session expired.
Note that session expired doesn't mean time of logout only, but can mean time of browser close or inactivity + session expire setting.
for the login, you can set a mashup loaded event in the master after the first re-direct from the Form Login screen.