logout_way (which is a boolean), doesn't seem to be a good split. there is no abstraction or separation of concerns, nor is there a reason to split the code into a subsection (it's one line)

a better approach would be to have logout_way return the proper command to be executed to log out