com.google.code.sbt.compiler.sbt0131.SBT0131Logger Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2013-2015 Grzegorz Slowikowski (gslowikowski at gmail dot com)
*
* Licensed 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.
*/
package com.google.code.sbt.compiler.sbt0131;
import com.google.code.sbt.compiler.api.CompilerLogger;
import xsbti.F0;
import xsbti.Logger;
/**
* {@link CompilerLogger} wrapper implementing SBT Logger interface.
*
* @author Grzegorz Slowikowski
*/
public class SBT0131Logger
implements Logger
{
CompilerLogger compilerLogger;
/**
* Creates SBT Logger wrapper around given {@link CompilerLogger} implementation.
*
* @param compilerLogger {@link CompilerLogger} delegate
*/
public SBT0131Logger( CompilerLogger compilerLogger )
{
this.compilerLogger = compilerLogger;
}
/**
* Send a message to the user in the error error level
* if the error error level is enabled.
*
* @param msg message
*/
@Override
public void error( F0 msg )
{
if ( compilerLogger.isErrorEnabled() )
{
compilerLogger.error( msg.apply() );
}
}
/**
* Send a message to the user in the warn error level
* if the warn error level is enabled.
*
* @param msg message
*/
@Override
public void warn( F0 msg )
{
if ( compilerLogger.isWarnEnabled() )
{
compilerLogger.warn( msg.apply() );
}
}
/**
* Send a message to the user in the info error level
* if the info error level is enabled.
*
* @param msg message
*/
@Override
public void info( F0 msg )
{
if ( compilerLogger.isInfoEnabled() )
{
compilerLogger.info( msg.apply() );
}
}
/**
* Send a message to the user in the debug error level
* if the debug error level is enabled.
*
* @param msg message
*/
@Override
public void debug( F0 msg )
{
if ( compilerLogger.isDebugEnabled() )
{
compilerLogger.debug( msg.apply() );
}
}
/**
* Send a message to the user in the trace error level
* if the trace error level is enabled.
*
* @param exception exception thrown
*/
@Override
public void trace( F0 exception )
{
if ( compilerLogger.isDebugEnabled() )
{
compilerLogger.debug( exception.apply() );
}
}
}