Find e.printStackTrace() calls inside a catch block

Proprietary

e.printStackTrace() writes to stderr — which in most server environments is either unread, unrotated, or both. Replace with a real logger call (log.error("context", e)) so the stack trace lands in the same place every other error in the application does.

org.openrewrite.kotlin.functional.FindPrintStackTraceInCatch$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.functional.FindPrintStackTraceInCatch$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.