All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bboss.org.apache.velocity.runtime.log.LogChuteSystem Maven / Gradle / Ivy

Go to download

bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com

There is a newer version: 6.2.5
Show newest version
package bboss.org.apache.velocity.runtime.log;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */

import bboss.org.apache.velocity.runtime.RuntimeServices;
import bboss.org.apache.velocity.util.StringUtils;

/**
 * Wrapper to make user's custom LogSystem implementations work
 * with the new LogChute setup.
 *
 * @author Nathan Bubna
 * @version $Id: LogChuteSystem.java 730039 2008-12-30 03:53:19Z byron $
 * @since 1.5
 */
public class LogChuteSystem implements LogChute
{

    private LogSystem logSystem;

    /**
     * Only classes in this package should be creating this.
     * Users should not have to mess with this class.
     * @param wrapMe
     */
    protected LogChuteSystem(LogSystem wrapMe)
    {
        this.logSystem = wrapMe;
    }

    /**
     * @see bboss.org.apache.velocity.runtime.log.LogChute#init(bboss.org.apache.velocity.runtime.RuntimeServices)
     */
    public void init(RuntimeServices rs) throws Exception
    {
        logSystem.init(rs);
    }

    /**
     * @see bboss.org.apache.velocity.runtime.log.LogChute#log(int, java.lang.String)
     */
    public void log(int level, String message)
    {
        logSystem.logVelocityMessage(level, message);
    }

    /**
     * First passes off the message at the specified level,
     * then passes off stack trace of the Throwable as a
     * 2nd message at the same level.
     * @param level
     * @param message
     * @param t
     */
    public void log(int level, String message, Throwable t)
    {
        logSystem.logVelocityMessage(level, message);
        logSystem.logVelocityMessage(level, StringUtils.stackTrace(t));
    }

    /**
     * @see bboss.org.apache.velocity.runtime.log.LogChute#isLevelEnabled(int)
     */
    public boolean isLevelEnabled(int level)
    {
        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy