mirror of https://github.com/qos-ch/slf4j
Use computeIfAbsent with a protected method, make reset protected
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
This commit is contained in:
parent
d564304a61
commit
db8cd90c10
|
|
@ -47,11 +47,17 @@ public class SimpleLoggerFactory implements ILoggerFactory {
|
|||
|
||||
/**
|
||||
* Return an appropriate {@link SimpleLogger} instance by name.
|
||||
*
|
||||
* This method will call {@link #createLogger(String)} if the logger
|
||||
* has not been created yet.
|
||||
*/
|
||||
public Logger getLogger(String name) {
|
||||
return loggerMap.computeIfAbsent(name, this::createLogger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually creates the logger for the given name.
|
||||
*/
|
||||
protected Logger createLogger(String name) {
|
||||
return new SimpleLogger(name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue