Rework GetTokenForLog() to use select/case instead of range