1
0
mirror of https://github.com/cekis/swg-api synced 2026-01-16 19:05:10 -05:00

Added negating to log filters

This commit is contained in:
Cekis
2021-03-29 23:56:02 -07:00
parent 1651a1f245
commit f57a0be08e
2 changed files with 32 additions and 19 deletions

View File

@@ -763,7 +763,7 @@ public class SwgConfiguration {
public String toString() {
StringBuilder output = new StringBuilder(type + ":" + path);
if(filters != null) {
if(filters != null && filters.size() > 0) {
int filterSize = filters.size();
output.append("{");
for (int i = 0; i < filterSize; i++) {
@@ -777,13 +777,14 @@ public class SwgConfiguration {
public static class LogTargetFilter {
private String type;
private String name;
private String match;
private boolean negate;
private boolean filtered;
LogTargetFilter() {}
public String toString() {
return getTypeValue() + getFilteredValue() + name;
return getTypeValue() + getFilteredValue() + (isNegate() ? "!" : "") + match;
}
private String getTypeValue() {
@@ -799,8 +800,10 @@ public class SwgConfiguration {
}
private String getFilteredValue() {
if(isFiltered()) return "-";
return "+";
if(isFiltered()) {
return isNegate() ? "+" : "-";
}
return isNegate() ? "-" : "+";
}
public String getType() {
@@ -811,12 +814,20 @@ public class SwgConfiguration {
this.type = type;
}
public String getName() {
return name;
public String getMatch() {
return match;
}
public void setName(String name) {
this.name = name;
public void setMatch(String match) {
this.match = match;
}
public boolean isNegate() {
return negate;
}
public void setNegate(boolean negate) {
this.negate = negate;
}
public boolean isFiltered() {

View File

@@ -139,16 +139,18 @@ sharedLog:
logTargets:
- type: net
path: 127.0.0.1:44467
filter:
# - type: file
# path: logs/log.txt
# filters:
# - type: channel
# name: profile
# filtered: true
# - type: channel
# name: CustomerService
# filtered: true
filters:
- type: file
path: logs/log.txt
filters:
- type: channel
match: profile
negate: true
filtered: true
- type: channel
match: CustomerService
negate: false
filtered: true
sharedNetwork:
oldestUnacknowledgedTimeout: 0
noDataTimeout: 1000000