<commit_before>package uk.nhs.ciao.logging;

/**
 * Reusable log message backed by a single StringBuilder.
 * <p>
 * The message is not thread-safe. If concurrent access is required, either
 * external synchronisation or thread-confinement is required (e.g. a ThreadLocal).
 * <p>
 * The log message can be reused via {@link #reset(CharSequence)}.
 * <p>
 * Package scoped so that implementation details to not leak into the main API.
 */
class ReusableLogMessage implements LogMessage {
	private final StringBuilder builder = new StringBuilder();
	private boolean beforeProperties;
	
	void clear() {
		this.builder.setLength(0);
		this.beforeProperties = true;
	}
	
	void reset(final CharSequence text) {
		clear();
		if (text != null && text.length() > 0) {
			this.builder.append(text);
			
			// For consistent formatting - ensure that the text ends with a full-stop
			if (text.charAt(text.length() - 1) != '.') {
				this.builder.append('.');
			}
		}
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public ReusableLogMessage set(final String key, final Object value) {
		if (beforeProperties) {
			if (builder.length() > 0) {
				builder.append("' '");
			}
			
			builder.append("Values -->");<commit_msg>Fixed incorrect pattern in log messages (' ' instead of a space character)<commit_after>package uk.nhs.ciao.logging;

/**
 * Reusable log message backed by a single StringBuilder.
 * <p>
 * The message is not thread-safe. If concurrent access is required, either
 * external synchronisation or thread-confinement is required (e.g. a ThreadLocal).
 * <p>
 * The log message can be reused via {@link #reset(CharSequence)}.
 * <p>
 * Package scoped so that implementation details to not leak into the main API.
 */
class ReusableLogMessage implements LogMessage {
	private final StringBuilder builder = new StringBuilder();
	private boolean beforeProperties;
	
	void clear() {
		this.builder.setLength(0);
		this.beforeProperties = true;
	}
	
	void reset(final CharSequence text) {
		clear();
		if (text != null && text.length() > 0) {
			this.builder.append(text);
			
			// For consistent formatting - ensure that the text ends with a full-stop
			if (text.charAt(text.length() - 1) != '.') {
				this.builder.append('.');
			}
		}
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public ReusableLogMessage set(final String key, final Object value) {
		if (beforeProperties) {
			if (builder.length() > 0) {
				builder.append(' ');
			}
			
			builder.append("Values -->");
{'fraction_non_alphanumeric': 0.12666397741024607, 'fraction_numerical': 0.003227107704719645, 'mean_word_length': 3.484629294755877, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '253912', 'n_tokens_mistral': 817, 'n_tokens_neox': 721, 'n_words': 242}