Pass the caught exception to ILogger calls

Proprietary

In a catch block, Microsoft.Extensions.Logging LogWarning, LogError, LogCritical and Log(LogLevel.Warning|Error|Critical, ...) calls that pass only a message lose the exception's type and stack trace. Pass the caught exception as the exception argument, unless the catch block already logs it.

OpenRewrite.Recipes.CSharp.CodeQuality.Logging.PassCaughtExceptionToLogger
mod run . --recipe=OpenRewrite.Recipes.CSharp.CodeQuality.Logging.PassCaughtExceptionToLogger

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