zack
6 years ago
5 changed files with 38 additions and 47 deletions
@ -1,16 +0,0 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Immutable; |
||||
import com.fr.third.apache.log4j.spi.LoggingEvent; |
||||
|
||||
public interface DesignerLoggingProcessor extends Immutable { |
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
String XML_TAG = "DesignerLoggingProcessor"; |
||||
|
||||
/** |
||||
* 输出日志对象 |
||||
* @param loggingEvent 日志对象 |
||||
*/ |
||||
void printLoggingEvent(LoggingEvent loggingEvent); |
||||
} |
@ -1,17 +0,0 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.DesignerLoggingProcessor; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
@API(level = DesignerLoggingProcessor.CURRENT_LEVEL) |
||||
public abstract class AbstractDesignerLoggingProcessor implements DesignerLoggingProcessor { |
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public int layerIndex() { |
||||
return DEFAULT_LAYER_INDEX; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.mainframe.loghandler; |
||||
|
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.third.apache.log4j.Level; |
||||
import com.fr.third.apache.log4j.spi.LoggingEvent; |
||||
import com.fr.third.apache.log4j.spi.ThrowableInformation; |
||||
|
||||
/** |
||||
* 设计器日志记录 |
||||
*/ |
||||
public class DesignerLogger { |
||||
public static final int INFO_INT = Level.INFO.toInt(); |
||||
|
||||
public static final int ERROR_INT = Level.ERROR.toInt(); |
||||
|
||||
public static final int WARN_INT = Level.WARN.toInt(); |
||||
|
||||
/** |
||||
* 记录LoggingEvent对象 |
||||
* @param event |
||||
*/ |
||||
public static void log(LoggingEvent event) { |
||||
if (event == null) { |
||||
return; |
||||
} |
||||
int intLevel = event.getLevel().toInt(); |
||||
ThrowableInformation information = event.getThrowableInformation(); |
||||
if (intLevel == INFO_INT) { |
||||
FineLoggerFactory.getLogger().info(event.getRenderedMessage()); |
||||
} else if (intLevel == ERROR_INT) { |
||||
FineLoggerFactory.getLogger().error(event.getRenderedMessage(), information == null ? null : information.getThrowable()); |
||||
} else if (intLevel == WARN_INT) { |
||||
FineLoggerFactory.getLogger().warn(event.getRenderedMessage(), information == null ? null : information.getThrowable()); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue