Home / Class/ ConditionEvaluationReportLogger Class — spring-boot Architecture

ConditionEvaluationReportLogger Class — spring-boot Architecture

Architecture documentation for the ConditionEvaluationReportLogger class in ConditionEvaluationReportLogger.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLogger.java lines 37–86

class ConditionEvaluationReportLogger {

	private final Log logger = LogFactory.getLog(getClass());

	private final Supplier<ConditionEvaluationReport> reportSupplier;

	private final LogLevel logLevel;

	ConditionEvaluationReportLogger(LogLevel logLevel, Supplier<ConditionEvaluationReport> reportSupplier) {
		Assert.isTrue(isInfoOrDebug(logLevel), "'logLevel' must be INFO or DEBUG");
		this.logLevel = logLevel;
		this.reportSupplier = reportSupplier;
	}

	private boolean isInfoOrDebug(LogLevel logLevel) {
		return LogLevel.INFO.equals(logLevel) || LogLevel.DEBUG.equals(logLevel);
	}

	void logReport(boolean isCrashReport) {
		ConditionEvaluationReport report = this.reportSupplier.get();
		if (report == null) {
			this.logger.info("Unable to provide the condition evaluation report");
			return;
		}
		if (!report.getConditionAndOutcomesBySource().isEmpty()) {
			if (this.logLevel.equals(LogLevel.INFO)) {
				if (this.logger.isInfoEnabled()) {
					this.logger.info(new ConditionEvaluationReportMessage(report));
				}
				else if (isCrashReport) {
					logMessage("info");
				}
			}
			else {
				if (this.logger.isDebugEnabled()) {
					this.logger.debug(new ConditionEvaluationReportMessage(report));
				}
				else if (isCrashReport) {
					logMessage("debug");
				}
			}
		}
	}

	private void logMessage(String logLevel) {
		this.logger.info(String.format("%n%nError starting ApplicationContext. To display the "
				+ "condition evaluation report re-run your application with '%s' enabled.", logLevel));
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free