An idea: Make the body of log:* safe if a condition is signalled in its body.
This is just an idea but this is a problem I have run into a few times and its more of a safe guard for programmer error than anything. But a common use case I have for log:* is to display a condition using the built in reporting ie (define-condition .. (:report ...)) but sometimes something like a slot might not be bound etc and a form like
(handler-case <something>
(serious-condition (condition)
(log:error "Something really went wrong: ~A" condition)
<something else>
...
Will cause everything to go kaboom if there is a failure on the programmers part to fill the slots correctly in condition
A quick fix I have just tried is to wrap the actual printing of the condition into a macro that will catch any problems and return a different string but it seems fitting that log:* should have a fallback message in the case that the body of log:* signals a condition.
Does this already exist? If not how does it sound as a potential feature?
Thanks.
The current behavior has been explicitly designed by the original author with the intention of making it easy for users to debug problems in log statements. The main mechanism is https://github.com/sharplispers/log4cl/blob/fe3da517147d023029782ced7cd989ba24f1e62d/src/logger.lisp#L560-L589 and https://github.com/sharplispers/log4cl/blob/fe3da517147d023029782ced7cd989ba24f1e62d/tests/test-appenders.lisp#L344-L370 tests the behavior.
I can see benefits of the current behavior as well as of the behavior you are suggesting. It seems the best solution would be a configuration option or special variable to select one of the behaviors similar to the way the fiveam library provides fiveam:*on-error* to select a behavior for unexpected errors during test execution.