This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch scm-979-delogging in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit 862db7f1553aca3e88a5192b0d655a29659ba129 Author: Tamas Cservenak <[email protected]> AuthorDate: Fri May 20 14:57:30 2022 +0200 [SCM-979] ScmLogger nonsense dropped Using plain Slf4j logging. Anyone integrating SCM should provide Slf4j implementation and configure it as he likes. --- .../java/org/apache/maven/scm/log/DefaultLog.java | 182 ---------------- .../org/apache/maven/scm/log/ScmLogDispatcher.java | 228 --------------------- .../java/org/apache/maven/scm/log/ScmLogger.java | 60 ------ .../org/apache/maven/scm/log/Slf4jScmLogger.java | 190 ----------------- .../org/apache/maven/scm/plugin/DefaultLog.java | 133 ------------ 5 files changed, 793 deletions(-) diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/log/DefaultLog.java b/maven-scm-api/src/main/java/org/apache/maven/scm/log/DefaultLog.java deleted file mode 100644 index bb81edaf2..000000000 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/log/DefaultLog.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.apache.maven.scm.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. - */ - -/** - * @author <a href="mailto:[email protected]">Emmanuel Venisse</a> - */ -@Deprecated -public class DefaultLog - implements ScmLogger -{ - - private boolean debug = false; - - public DefaultLog() - { - // no op - } - - public DefaultLog( boolean debug ) - { - this.debug = debug; - } - - /** - * {@inheritDoc} - */ - public boolean isDebugEnabled() - { - return this.debug; - } - - /** - * {@inheritDoc} - */ - public void debug( String content ) - { - if ( this.debug ) - { - System.out.println( content ); - } - } - - /** - * {@inheritDoc} - */ - public void debug( String content, Throwable error ) - { - if ( this.debug ) - { - System.out.println( content ); - error.printStackTrace(); - } - } - - /** - * {@inheritDoc} - */ - public void debug( Throwable error ) - { - if ( this.debug ) - { - error.printStackTrace(); - } - } - - /** - * {@inheritDoc} - */ - public boolean isInfoEnabled() - { - return true; - } - - /** - * {@inheritDoc} - */ - public void info( String content ) - { - System.out.println( content ); - } - - /** - * {@inheritDoc} - */ - public void info( String content, Throwable error ) - { - System.out.println( content ); - error.printStackTrace(); - } - - /** - * {@inheritDoc} - */ - public void info( Throwable error ) - { - error.printStackTrace(); - } - - /** - * {@inheritDoc} - */ - public boolean isWarnEnabled() - { - return true; - } - - /** - * {@inheritDoc} - */ - public void warn( String content ) - { - System.out.println( content ); - } - - /** - * {@inheritDoc} - */ - public void warn( String content, Throwable error ) - { - System.out.println( content ); - error.printStackTrace(); - } - - /** - * {@inheritDoc} - */ - public void warn( Throwable error ) - { - error.printStackTrace(); - } - - /** - * {@inheritDoc} - */ - public boolean isErrorEnabled() - { - return true; - } - - /** - * {@inheritDoc} - */ - public void error( String content ) - { - System.out.print( "[ERROR] " + content ); - } - - /** - * {@inheritDoc} - */ - public void error( String content, Throwable error ) - { - System.out.println( "[ERROR] " + content ); - error.printStackTrace(); - } - - /** - * {@inheritDoc} - */ - public void error( Throwable error ) - { - error.printStackTrace(); - } -} diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogDispatcher.java b/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogDispatcher.java deleted file mode 100644 index fba4fa46e..000000000 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogDispatcher.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.apache.maven.scm.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 java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * @author <a href="mailto:[email protected]">Emmanuel Venisse</a> - * - */ -@Deprecated -public class ScmLogDispatcher - implements ScmLogger -{ - private final List<ScmLogger> listeners = new CopyOnWriteArrayList<>(); - - public void addListener( ScmLogger logger ) - { - listeners.add( logger ); - } - - /** {@inheritDoc} */ - @Override - public void debug( String content, Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.debug( content, error ); - } - } - - /** {@inheritDoc} */ - @Override - public void debug( String content ) - { - for ( ScmLogger logger : listeners ) - { - logger.debug( content ); - } - } - - /** {@inheritDoc} */ - @Override - public void debug( Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.debug( error ); - } - } - - /** {@inheritDoc} */ - @Override - public void error( String content, Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.error( content, error ); - } - } - - /** {@inheritDoc} */ - @Override - public void error( String content ) - { - for ( ScmLogger logger : listeners ) - { - logger.error( content ); - } - } - - /** {@inheritDoc} */ - @Override - public void error( Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.error( error ); - } - } - - /** {@inheritDoc} */ - @Override - public void info( String content, Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isInfoEnabled() ) - { - logger.info( content, error ); - } - } - } - - /** {@inheritDoc} */ - @Override - public void info( String content ) - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isInfoEnabled() ) - { - logger.info( content ); - } - } - } - - /** {@inheritDoc} */ - @Override - public void info( Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isInfoEnabled() ) - { - logger.info( error ); - } - } - } - - /** {@inheritDoc} */ - @Override - public boolean isDebugEnabled() - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isDebugEnabled() ) - { - return true; - } - } - - return false; - } - - /** {@inheritDoc} */ - @Override - public boolean isErrorEnabled() - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isErrorEnabled() ) - { - return true; - } - } - - return false; - } - - /** {@inheritDoc} */ - @Override - public boolean isInfoEnabled() - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isInfoEnabled() ) - { - return true; - } - } - - return false; - } - - /** {@inheritDoc} */ - @Override - public boolean isWarnEnabled() - { - for ( ScmLogger logger : listeners ) - { - if ( logger.isWarnEnabled() ) - { - return true; - } - } - - return false; - } - - /** {@inheritDoc} */ - @Override - public void warn( String content, Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.warn( content, error ); - } - } - - /** {@inheritDoc} */ - @Override - public void warn( String content ) - { - for ( ScmLogger logger : listeners ) - { - logger.warn( content ); - } - } - - /** {@inheritDoc} */ - @Override - public void warn( Throwable error ) - { - for ( ScmLogger logger : listeners ) - { - logger.warn( error ); - } - } -} diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogger.java b/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogger.java deleted file mode 100644 index 9801fbe06..000000000 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/log/ScmLogger.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.maven.scm.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. - */ - -/** - * @author <a href="mailto:[email protected]">Emmanuel Venisse</a> - * - */ -@Deprecated -public interface ScmLogger -{ - boolean isDebugEnabled(); - - void debug( String content ); - - void debug( String content, Throwable error ); - - void debug( Throwable error ); - - boolean isInfoEnabled(); - - void info( String content ); - - void info( String content, Throwable error ); - - void info( Throwable error ); - - boolean isWarnEnabled(); - - void warn( String content ); - - void warn( String content, Throwable error ); - - void warn( Throwable error ); - - boolean isErrorEnabled(); - - void error( String content ); - - void error( String content, Throwable error ); - - void error( Throwable error ); -} diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/log/Slf4jScmLogger.java b/maven-scm-api/src/main/java/org/apache/maven/scm/log/Slf4jScmLogger.java deleted file mode 100644 index c978f9190..000000000 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/log/Slf4jScmLogger.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.apache.maven.scm.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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static java.util.Objects.requireNonNull; - -/** - * {@link ScmLogger} backed by Slf4j. - * - * @since TBD - */ -public class Slf4jScmLogger - implements ScmLogger -{ - private final Logger logger; - - public Slf4jScmLogger( final Class<?> owner ) - { - this( LoggerFactory.getLogger( requireNonNull( owner ) ) ); - } - - public Slf4jScmLogger( final Logger logger ) - { - this.logger = requireNonNull( logger ); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDebugEnabled() - { - return this.logger.isDebugEnabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug( String content ) - { - this.logger.debug( content ); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug( String content, Throwable error ) - { - this.logger.debug( content, error ); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug( Throwable error ) - { - this.logger.debug( "", error ); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isInfoEnabled() - { - return this.logger.isInfoEnabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void info( String content ) - { - this.logger.info( content ); - } - - /** - * {@inheritDoc} - */ - @Override - public void info( String content, Throwable error ) - { - this.logger.info( content, error ); - } - - /** - * {@inheritDoc} - */ - @Override - public void info( Throwable error ) - { - this.logger.info( "", error ); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isWarnEnabled() - { - return this.logger.isWarnEnabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn( String content ) - { - this.logger.warn( content ); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn( String content, Throwable error ) - { - this.logger.warn( content, error ); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn( Throwable error ) - { - this.logger.warn( "", error ); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isErrorEnabled() - { - return this.logger.isErrorEnabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void error( String content ) - { - this.logger.error( content ); - } - - /** - * {@inheritDoc} - */ - @Override - public void error( String content, Throwable error ) - { - this.logger.error( content, error ); - } - - /** - * {@inheritDoc} - */ - @Override - public void error( Throwable error ) - { - this.logger.error( "", error ); - } -} diff --git a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DefaultLog.java b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DefaultLog.java deleted file mode 100644 index bcae56050..000000000 --- a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DefaultLog.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.apache.maven.scm.plugin; - -/* - * 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 org.apache.maven.plugin.logging.Log; -import org.apache.maven.scm.log.ScmLogger; - -/** - * @author <a href="mailto:[email protected]">Emmanuel Venisse</a> - */ -public class DefaultLog - implements ScmLogger -{ - private Log logger; - - public DefaultLog( Log logger ) - { - this.logger = logger; - } - - /** {@inheritDoc} */ - public boolean isDebugEnabled() - { - return logger.isDebugEnabled(); - } - - /** {@inheritDoc} */ - public void debug( String content ) - { - logger.debug( content ); - } - - /** {@inheritDoc} */ - public void debug( String content, Throwable error ) - { - logger.debug( content, error ); - } - - /** {@inheritDoc} */ - public void debug( Throwable error ) - { - logger.debug( error ); - } - - /** {@inheritDoc} */ - public boolean isInfoEnabled() - { - return logger.isInfoEnabled(); - } - - /** {@inheritDoc} */ - public void info( String content ) - { - logger.info( content ); - } - - /** {@inheritDoc} */ - public void info( String content, Throwable error ) - { - logger.info( content, error ); - } - - /** {@inheritDoc} */ - public void info( Throwable error ) - { - logger.info( error ); - } - - /** {@inheritDoc} */ - public boolean isWarnEnabled() - { - return logger.isWarnEnabled(); - } - - /** {@inheritDoc} */ - public void warn( String content ) - { - logger.warn( content ); - } - - /** {@inheritDoc} */ - public void warn( String content, Throwable error ) - { - logger.warn( content, error ); - } - - /** {@inheritDoc} */ - public void warn( Throwable error ) - { - logger.warn( error ); - } - - /** {@inheritDoc} */ - public boolean isErrorEnabled() - { - return logger.isErrorEnabled(); - } - - /** {@inheritDoc} */ - public void error( String content ) - { - logger.error( content ); - } - - /** {@inheritDoc} */ - public void error( String content, Throwable error ) - { - logger.error( content, error ); - } - - /** {@inheritDoc} */ - public void error( Throwable error ) - { - logger.error( error ); - } -}
