<commit_before>/*
 * JGrapes Event Driven Framework
 * Copyright (C) 2016  <NAME>
 * 
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, see <http://www.gnu.org/licenses/>.
 */
package org.jgrapes.core.internal;

import java.lang.reflect.Method;

import org.jgrapes.core.Component;
import org.jgrapes.core.EventPipeline;

/**
 * An variant of handler reference that provides better debug information
 * (at the cost of some cpu cycles).
 * 
 * @author <NAME>
 *
 */
class VerboseHandlerReference extends HandlerReference {

	private Component component;
	private String handlerName;
	
	/**
	 * @param eventKey
	 * @param channelKey
	 * @param component
	 * @param method
	 * @param eventParam
	 * @param priority
	 */
	public VerboseHandlerReference(Object eventKey, Object channelKey,
	        Component component, Method method, boolean eventParam,
	        int priority) {
		super(eventKey, channelKey, component, method, eventParam, priority);
		this.component = component;
		handlerName = Common.classToString(component.getClass())
				+ "#" + method.getName();
	}

	/**
	 * Invoke the handler with the given event as parameter. 
	 * 
	 * @param event the event
	 */
	@Override
	public void invoke(EventBase event) throws Throwable {
		StringBuilder builder = new StringBuilder();
		builder.append("P");
		builder.append(Common.getId(EventPipeline.class, 
				FeedBackPipelineFilter.getAssociatedPipeline()));
		builder.append(": ");
		builder.append(event);
		if (component == ComponentTree.DUMMY_HANDLER) {
			builder.append(" (unhandled)");
		} else {
			builder.append(" --> " + this);
		}
		handlerTracking.fine(builder.toString());
		super.invoke(event);
	}

	@Override
	protected String methodToString() {
		return handlerName;
	}
<commit_msg>Changed log format.<commit_after>/*
 * JGrapes Event Driven Framework
 * Copyright (C) 2016  <NAME>
 * 
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, see <http://www.gnu.org/licenses/>.
 */
package org.jgrapes.core.internal;

import java.lang.reflect.Method;

import org.jgrapes.core.Component;
import org.jgrapes.core.EventPipeline;

/**
 * An variant of handler reference that provides better debug information
 * (at the cost of some cpu cycles).
 * 
 * @author <NAME>
 *
 */
class VerboseHandlerReference extends HandlerReference {

	private Component component;
	private String handlerName;
	
	/**
	 * @param eventKey
	 * @param channelKey
	 * @param component
	 * @param method
	 * @param eventParam
	 * @param priority
	 */
	public VerboseHandlerReference(Object eventKey, Object channelKey,
	        Component component, Method method, boolean eventParam,
	        int priority) {
		super(eventKey, channelKey, component, method, eventParam, priority);
		this.component = component;
		handlerName = Common.classToString(component.getClass())
				+ "#" + method.getName();
	}

	/**
	 * Invoke the handler with the given event as parameter. 
	 * 
	 * @param event the event
	 */
	@Override
	public void invoke(EventBase event) throws Throwable {
		StringBuilder builder = new StringBuilder();
		builder.append("P");
		builder.append(Common.getId(EventPipeline.class, 
				FeedBackPipelineFilter.getAssociatedPipeline()));
		builder.append(": ");
		builder.append(event);
		if (component == ComponentTree.DUMMY_HANDLER) {
			builder.append(" (unhandled)");
		} else {
			builder.append(" >> " + this);
		}
		handlerTracking.fine(builder.toString());
		super.invoke(event);
	}

	@Override
	protected String methodToString() {
		return handlerName;
	}

{'fraction_non_alphanumeric': 0.09860064585575888, 'fraction_numerical': 0.002152852529601722, 'mean_word_length': 3.8905263157894736, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2279154', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1254, 'n_words': 454}