comparison src/fschmidt/util/log4j/CountingEvaluator.java @ 68:00520880ad02

add fschmidt source
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 05 Oct 2025 17:24:15 -0600
parents
children
comparison
equal deleted inserted replaced
67:9d0fefce6985 68:00520880ad02
1 package fschmidt.util.log4j;
2
3 import org.apache.log4j.spi.LoggingEvent;
4 import org.apache.log4j.spi.TriggeringEventEvaluator;
5
6
7 public final class CountingEvaluator implements TriggeringEventEvaluator {
8 private final int limit;
9 private int count = 0;
10
11 public CountingEvaluator(int limit) {
12 this.limit = limit;
13 }
14
15 public boolean isTriggeringEvent(LoggingEvent event) {
16 if( ++count < limit ) {
17 return false;
18 } else {
19 count = 0;
20 return true;
21 }
22 }
23 }