View Javadoc
1   /*
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2022, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core.testUtil;
15  
16  import java.util.ArrayList;
17  import java.util.List;
18  
19  import ch.qos.logback.core.spi.LifeCycle;
20  import ch.qos.logback.core.status.Status;
21  import ch.qos.logback.core.status.StatusListener;
22  
23  public class TrivialStatusListener implements StatusListener, LifeCycle {
24  
25      public List<Status> list = new ArrayList<Status>();
26      boolean start = false;
27  
28      public void addStatusEvent(Status status) {
29          if (!isStarted())
30              return;
31          list.add(status);
32      }
33  
34      public void start() {
35          start = true;
36      }
37  
38      public void stop() {
39          start = false;
40      }
41  
42      public boolean isStarted() {
43          return start;
44      }
45  }