Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDEP-923] Remove plexus logger from DependencySilentLog #383

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
package org.apache.maven.plugins.dependency.utils;

import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.logging.Logger;

/**
* This logger implements both types of logs currently in use and turns off logs.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
*/
public class DependencySilentLog implements Log, Logger {
public class DependencySilentLog implements Log {
/**
* @return <code>false</code>
* @see org.apache.maven.plugin.logging.Log#isDebugEnabled()
Expand Down Expand Up @@ -184,148 +183,4 @@ public void error(CharSequence content, Throwable error) {
public void error(Throwable error) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#debug(java.lang.String)
*/
@Override
public void debug(String message) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#debug(java.lang.String, java.lang.Throwable)
*/
@Override
public void debug(String message, Throwable throwable) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#info(java.lang.String)
*/
@Override
public void info(String message) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#info(java.lang.String, java.lang.Throwable)
*/
@Override
public void info(String message, Throwable throwable) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#warn(java.lang.String)
*/
@Override
public void warn(String message) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#warn(java.lang.String, java.lang.Throwable)
*/
@Override
public void warn(String message, Throwable throwable) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#error(java.lang.String)
*/
@Override
public void error(String message) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#error(java.lang.String, java.lang.Throwable)
*/
@Override
public void error(String message, Throwable throwable) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String)
*/
@Override
public void fatalError(String message) {
// nop
}

/**
* By default, do nothing.
*
* @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String, java.lang.Throwable)
*/
@Override
public void fatalError(String message, Throwable throwable) {
// nop
}

/**
* @return <code>false</code>
* @see org.codehaus.plexus.logging.Logger#isFatalErrorEnabled()
*/
@Override
public boolean isFatalErrorEnabled() {
return false;
}

/**
* @return <code>null</code>
* @see org.codehaus.plexus.logging.Logger#getChildLogger(java.lang.String)
*/
@Override
public Logger getChildLogger(String name) {
return null;
}

/**
* @return <code>0</code>
* @see org.codehaus.plexus.logging.Logger#getThreshold()
*/
@Override
public int getThreshold() {
return 0;
}

/**
* By default, do nothing
*/
@Override
public void setThreshold(int threshold) {
// nop
}

/**
* @return <code>null</code>
* @see org.codehaus.plexus.logging.Logger#getName()
*/
@Override
public String getName() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
package org.apache.maven.plugins.dependency.utils;

import junit.framework.TestCase;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.logging.Logger;
import org.junit.Test;

public class TestSilentLog extends TestCase {
public class TestSilentLog {

@Test
public void testLog() {
Log log = new DependencySilentLog();
String text = "Text";
Expand All @@ -45,30 +45,4 @@ public void testLog() {
log.isWarnEnabled();
log.isInfoEnabled();
}

public void testLogger() {
Logger log = new DependencySilentLog();
String text = "Text";
Throwable e = new RuntimeException();

log.debug(text);
log.debug(text, e);
log.error(text);
log.error(text, e);
log.warn(text);
log.warn(text, e);
log.info(text);
log.info(text, e);

log.fatalError(text);
log.fatalError(text, e);
log.getChildLogger(text);
log.getName();
log.getThreshold();
log.isDebugEnabled();
log.isErrorEnabled();
log.isFatalErrorEnabled();
log.isInfoEnabled();
log.isWarnEnabled();
}
}