annotate src/goodjava/logger/ListAppender.java @ 1648:224af797b1f9

Mainly small install script improvements - Consistent usage of `$LUANHOME`, removed reliance on current directory. - Made Luan build and install fine (on Linux) without requiring launching it via sudo. Only asks to elevate privileges if installation failed. - Minor spelling mistake fix.
author Fox
date Mon, 28 Mar 2022 18:00:12 +0200
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 }