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

style: Change the structure of the log to make the log sdk more light… #83

Merged
merged 1 commit into from
Dec 9, 2021
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 @@ -17,22 +17,13 @@
package group.rxcloud.capa.spi.log;

import group.rxcloud.capa.component.log.CapaLog4jAppenderAgent;
import group.rxcloud.capa.spi.log.enums.CapaLogLevel;
import group.rxcloud.capa.spi.log.manager.LogManager;
import org.apache.logging.log4j.core.LogEvent;

import java.util.Optional;

public abstract class CapaLog4jAppenderSpi implements CapaLog4jAppenderAgent.CapaLog4jAppender {

@Override
public void append(LogEvent event) {
if (event != null && event.getLevel()!= null) {
Optional<CapaLogLevel> capaLogLevel = CapaLogLevel.toCapaLogLevel(event.getLevel().name());
if (capaLogLevel.isPresent() && LogManager.whetherLogsCanOutput(capaLogLevel.get())) {
this.appendLog(event);
}
}
this.appendLog(event);
}

protected abstract void appendLog(LogEvent event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,13 @@
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import group.rxcloud.capa.component.log.CapaLogbackAppenderAgent;
import group.rxcloud.capa.spi.log.enums.CapaLogLevel;
import group.rxcloud.capa.spi.log.manager.LogManager;

import java.util.Optional;

public abstract class CapaLogbackAppenderSpi extends UnsynchronizedAppenderBase<ILoggingEvent>
implements CapaLogbackAppenderAgent.CapaLogbackAppender {

@Override
public void append(ILoggingEvent event) {
if (event != null && event.getLevel() != null) {
Optional<CapaLogLevel> capaLogLevel = CapaLogLevel.toCapaLogLevel(event.getLevel().levelStr);
if (capaLogLevel.isPresent() && LogManager.whetherLogsCanOutput(capaLogLevel.get())) {
this.appendLog(event);
}
}
this.appendLog(event);
}

protected abstract void appendLog(ILoggingEvent event);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.