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

com.pastdev.jsch.Slf4jBridge Maven / Gradle / Ivy

Go to download

A set of extensions on top of JSch providing a full SCP protocol implementation, tunneling including multi-hop, a Java 7 FileSystem like implementation for Java 6 and remote command execution

There is a newer version: 0.1.11
Show newest version
package com.pastdev.jsch;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * Bridges all JSch logging to the SLF4J API.
 */
public class Slf4jBridge implements com.jcraft.jsch.Logger {
    private static Logger logger = LoggerFactory.getLogger( Slf4jBridge.class );

    public boolean isEnabled( int level ) {
        switch ( level ) {
            case com.jcraft.jsch.Logger.DEBUG:
                return logger.isDebugEnabled();
            case com.jcraft.jsch.Logger.INFO:
                return logger.isInfoEnabled();
            case com.jcraft.jsch.Logger.WARN:
                return logger.isWarnEnabled();
            case com.jcraft.jsch.Logger.ERROR:
                return logger.isErrorEnabled();
            case com.jcraft.jsch.Logger.FATAL:
                return true;
            default:
                return logger.isTraceEnabled();
        }
    }

    public void log( int level, String message ) {
        switch ( level ) {
            case com.jcraft.jsch.Logger.DEBUG:
                logger.debug( message );
                break;
            case com.jcraft.jsch.Logger.INFO:
                logger.info( message );
                break;
            case com.jcraft.jsch.Logger.WARN:
                logger.warn( message );
                break;
            case com.jcraft.jsch.Logger.ERROR:
                logger.error( message );
                break;
            case com.jcraft.jsch.Logger.FATAL:
                logger.error( message );
                break;
            default:
                logger.trace( message );
                break;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy