logWarning inside a closure causes capture