changeset 1452:c15444f4da05

Slf4jFactory
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 01 Mar 2020 16:05:26 -0700
parents 85d7c1777357
children 928be2a4d565
files lib/slf4j-api-1.7.30.jar src/goodjava/logging/Slf4jFactory.java
diffstat 2 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file lib/slf4j-api-1.7.30.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/goodjava/logging/Slf4jFactory.java	Sun Mar 01 16:05:26 2020 -0700
@@ -0,0 +1,56 @@
+package goodjava.logging;
+
+
+public final class Slf4jFactory implements ILoggerFactory {
+	private static final class Slf4jLogger implements Logger {
+		final org.slf4j.Logger slf4j;
+
+		Slf4jLogger(org.slf4j.Logger slf4j) {
+			this.slf4j = slf4j;
+		}
+
+		@Override public void error(String msg) {
+			slf4j.error(msg);
+		}
+
+		@Override public void error(String msg,Throwable t) {
+			slf4j.error(msg,t);
+		}
+
+		@Override public void warn(String msg) {
+			slf4j.warn(msg);
+		}
+
+		@Override public void warn(String msg,Throwable t) {
+			slf4j.warn(msg,t);
+		}
+
+		@Override public void info(String msg) {
+			slf4j.info(msg);
+		}
+
+		@Override public void info(String msg,Throwable t) {
+			slf4j.info(msg,t);
+		}
+
+		@Override public boolean isInfoEnabled() {
+			return slf4j.isInfoEnabled();
+		}
+
+		@Override public void debug(String msg) {
+			slf4j.debug(msg);
+		}
+
+		@Override public void debug(String msg,Throwable t) {
+			slf4j.debug(msg,t);
+		}
+
+		@Override public boolean isDebugEnabled() {
+			return slf4j.isDebugEnabled();
+		}
+	}
+
+	@Override public Logger getLogger(String name) {
+		return new Slf4jLogger(org.slf4j.LoggerFactory.getLogger(name));
+	}
+}