diff src/goodjava/logger/GoodLoggerFactory.java @ 1448:6fc083e1d08c

start logger
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 Feb 2020 18:14:32 -0700
parents
children 28b1ddacfad3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/goodjava/logger/GoodLoggerFactory.java	Sun Feb 23 18:14:32 2020 -0700
@@ -0,0 +1,20 @@
+package goodjava.logger;
+
+import java.util.Map;
+import java.util.HashMap;
+import goodjava.logging.ILoggerFactory;
+import goodjava.logging.Logger;
+
+
+public class GoodLoggerFactory implements ILoggerFactory {
+	private final Map<String,GoodLogger> map = new HashMap<String,GoodLogger>();
+
+	@Override public synchronized Logger getLogger(String name) {
+		GoodLogger logger = map.get(name);
+		if( logger == null ) {
+			logger = new GoodLogger(name);
+			map.put(name,logger);
+		}
+		return logger;
+	}
+}