    001//  Copyright 2008-2013 The Apache Software Foundation
    002//
    003// Licensed under the Apache License, Version 2.0 (the "License");
    004// you may not use this file except in compliance with the License.
    005// You may obtain a copy of the License at
    006//
    007//     http://www.apache.org/licenses/LICENSE-2.0
    008//
    009// Unless required by applicable law or agreed to in writing, software
    010// distributed under the License is distributed on an "AS IS" BASIS,
    011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012// See the License for the specific language governing permissions and
    013// limitations under the License.
    014
    015package org.apache.tapestry5;
    016
    017import org.slf4j.Marker;
    018import org.slf4j.MarkerFactory;
    019
    020import java.util.Arrays;
    021
    022/**
    023 * A set of markers used internally by Tapestry when logging in code related to paqes and components. Most logging
    024 * toolkits, including Log4J, do not incorporate markers, but  <a href="http://logback.qos.ch/">LOGBack</a> does.
    025 */
    026public class TapestryMarkers
    027{
    028    /**
    029     * A root marker for all things Tapestry related. The remaining markers are children of the TAPESTRY marker.
    030     */
    031    public static final Marker TAPESTRY = MarkerFactory.getMarker("TAPESTRY");
    032
    033    /**
    034     * Logs the final version of the class transformation. This is useful when debugging {@linkplain
    035     * org.apache.tapestry5.services.transform.ComponentClassTransformWorker2 component class transformers},
    036     * as it shows exactly what transformation operations
    037     * occurred, at the Java code level.
    038     */
    039    public static final Marker CLASS_TRANSFORMATION = MarkerFactory.getMarker("CLASS_TRANSFORMATION");
    040
    041    /**
    042     * Marker for a debug log that occurs just before invocation of a event handler method.
    043     */
    044    public static final Marker EVENT_HANDLER_METHOD = MarkerFactory.getMarker("EVENT_HANDLER_METHOD");
    045
    046    /**
    047     * Marker for logging related to component event dispatch.
    048     */
    049    public static final Marker EVENT_DISPATCH = MarkerFactory.getMarker("EVENT_DISPATCH");
    050
    051    /**
    052     * Marker for logging, at trace level, verbose details about each individual {@link
    053     * org.apache.tapestry5.runtime.RenderCommand} involved in rendering the page, as well as a final (debug level)
    054     * summary of command count and elapsed time.
    055     */
    056
    057    public static final Marker RENDER_COMMANDS = MarkerFactory.getMarker("RENDER_COMMANDS");
    058
    059    static
    060    {
    061        for (Marker child : Arrays.asList(CLASS_TRANSFORMATION, EVENT_HANDLER_METHOD, EVENT_DISPATCH, RENDER_COMMANDS))
    062        {
    063            TAPESTRY.add(child);
    064        }
    065    }
    066}