private synchronized Logger doGetLogger(String name) throws Exception { Logger logger = loggers.get(name); if (logger == null) { final ChronicleLogWriter writer = manager.createWriter(name); if (manager.isSimple(name)) { logger = new ChronicleLogger.Text(writer, name, ChronicleLogLevel.WARN); } else if (manager.isBinary(name)) { logger = new ChronicleLogger.Binary(writer, name, manager.cfg().getLevel(name)); } else if (manager.isText(name)) { logger = new ChronicleLogger.Text(writer, name, manager.cfg().getLevel(name)); } if (logger != null) { loggers.put(name, logger); } else { System.err.println( new StringBuilder("Unable to get a logger for ") .append("(") .append(name) .append(")") .toString()); } } return logger; }
/** c-tor */ public ChronicleLoggerFactory() { this.loggers = new ConcurrentHashMap<>(); this.manager = ChronicleLogManager.getInstance(); }