Fix online_players function, refactor and document log function