1   /*
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2026, 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 v2.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  
15  package ch.qos.logback.classic.spi;
16  
17  import java.util.ArrayList;
18  import java.util.List;
19  
20  import ch.qos.logback.classic.Level;
21  import ch.qos.logback.classic.Logger;
22  import ch.qos.logback.classic.LoggerContext;
23  import ch.qos.logback.classic.spi.BasicContextListener.UpdateType;
24  
25  public class ListContextListener implements LoggerContextListener {
26  
27      List<BasicContextListener.UpdateType> updateList = new ArrayList<>();
28  
29      @Override
30      public boolean isResetResistant() {
31          return false;
32      }
33  
34      @Override
35      public void onStart(LoggerContext context) {
36          updateList.add(UpdateType.START);
37      }
38  
39      @Override
40      public void onReset(LoggerContext context) {
41          updateList.add(UpdateType.RESET);
42      }
43  
44      @Override
45      public void onStop(LoggerContext context) {
46          updateList.add(UpdateType.STOP);
47  
48      }
49  
50      @Override
51      public void onLevelChange(Logger logger, Level level) {
52          updateList.add(UpdateType.LEVEL_CHANGE);
53      }
54  
55  }