Chain-of-responsibility pattern: Difference between revisions

Content deleted Content added
m Java example: clearer variable name
m Java example: changed method name to make it more meaningful
Line 77:
}
 
static Logger loggercreateLogger(LogLevel[] levels, Consumer<String> stringConsumer) {
EnumSet<LogLevel> set = EnumSet.copyOf(Arrays.asList(levels));
return (msg, severity) -> {
Line 87:
 
static Logger consoleLogger(LogLevel... levels) {
return loggercreateLogger(levels, msg -> System.err.println("Writing to console: " + msg));
}
 
static Logger emailLogger(LogLevel... levels) {
return loggercreateLogger(levels, msg -> System.err.println("Sending via email: " + msg));
}
 
static Logger fileLogger(LogLevel... levels) {
return loggercreateLogger(levels, msg -> System.err.println("Writing to Log File: " + msg));
}