org.apache.james.protocols.api.logger.ProtocolSessionLogger Maven / Gradle / Ivy
/****************************************************************
* 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. *
****************************************************************/
package org.apache.james.protocols.api.logger;
/**
* A {@link Logger} implementation which suffix every log message with the
* session id Id
*
* @deprecated use {@link ContextualLogger}
*
*/
@Deprecated
public class ProtocolSessionLogger implements Logger {
private final Logger logger;
private final String id;
public ProtocolSessionLogger(String id, Logger logger) {
this.logger = logger;
this.id = id;
}
private String getText(String str) {
return "ID=" + id + " " + str;
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#debug(java.lang.String)
*/
public void debug(String arg0) {
logger.debug(getText(arg0));
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#debug(java.lang.String, java.lang.Throwable)
*/
public void debug(String arg0, Throwable arg1) {
logger.debug(getText(arg0), arg1);
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#error(java.lang.String)
*/
public void error(String arg0) {
logger.error(getText(arg0));
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#error(java.lang.String, java.lang.Throwable)
*/
public void error(String arg0, Throwable arg1) {
logger.error(getText(arg0), arg1);
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#info(java.lang.String)
*/
public void info(String arg0) {
logger.info(getText(arg0));
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#info(java.lang.String, java.lang.Throwable)
*/
public void info(String arg0, Throwable arg1) {
logger.info(getText(arg0), arg1);
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#isDebugEnabled()
*/
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#isErrorEnabled()
*/
public boolean isErrorEnabled() {
return logger.isErrorEnabled();
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#isInfoEnabled()
*/
public boolean isInfoEnabled() {
return logger.isInfoEnabled();
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#isTraceEnabled()
*/
public boolean isTraceEnabled() {
return logger.isTraceEnabled();
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#isWarnEnabled()
*/
public boolean isWarnEnabled() {
return logger.isWarnEnabled();
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#trace(java.lang.String)
*/
public void trace(String arg0) {
logger.trace(getText(arg0));
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#trace(java.lang.String, java.lang.Throwable)
*/
public void trace(String arg0, Throwable arg1) {
logger.trace(getText(arg0), arg1);
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#warn(java.lang.String)
*/
public void warn(String arg0) {
logger.warn(getText(arg0));
}
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.logger.Logger#warn(java.lang.String, java.lang.Throwable)
*/
public void warn(String arg0, Throwable arg1) {
logger.warn(getText(arg0), arg1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy