rule_logger: Avoid assertion if there is not a context available for logging as it is better to log than crash in this case.