There may be a more direct way, but I would use something like:
if(qa_logged_in_userid()) {
// show log out
}
else {
// show login