Skip to content

Commit

Permalink
Merge pull request #83 from reactivegroup/feature/metrics
Browse files Browse the repository at this point in the history
style: Change the structure of the log to make the log sdk more light…
  • Loading branch information
dgzpg authored Dec 9, 2021
2 parents da82340 + b2e5bdc commit 3223d4c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 292 deletions.
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.

0 comments on commit 3223d4c

Please sign in to comment.