annotate src/goodjava/logger/ListAppender.java @ 1640:570f3d483a31

host - move https.luan into src
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 21 Dec 2021 16:54:26 -0700
parents 85d7c1777357
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1449
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.logger;
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
1451
Franklin Schmidt <fschmidt@gmail.com>
parents: 1449
diff changeset
4 public final class ListAppender implements Appender {
1449
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 private final Appender[] appenders;
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 public ListAppender(Appender... appenders) {
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 this.appenders = appenders;
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 }
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 public synchronized void append(LoggingEvent event) {
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 for( Appender appender : appenders ) {
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 appender.append(event);
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 }
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 }
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 public void close() {
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 for( Appender appender : appenders ) {
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 appender.close();
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 }
dd14d2dce7ee add appenders
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 }