diff src/goodjava/logger/LevelAppender.java @ 1449:dd14d2dce7ee

add appenders
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 28 Feb 2020 21:14:23 -0700
parents
children 85d7c1777357
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/goodjava/logger/LevelAppender.java	Fri Feb 28 21:14:23 2020 -0700
@@ -0,0 +1,21 @@
+package goodjava.logger;
+
+
+public class LevelAppender implements Appender {
+	private final Appender appender;
+	private final int level;
+
+	public LevelAppender(Appender appender,int level) {
+		this.appender = appender;
+		this.level = level;
+	}
+
+	public void append(LoggingEvent event) {
+		if( event.level >= this.level )
+			appender.append(event);
+	}
+
+	public void close() {
+		appender.close();
+	}
+}