View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, 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.classic.control;
15  
16  import org.slf4j.helpers.MarkerIgnoringBase;
17  
18  import ch.qos.logback.classic.Level;
19  
20  /**
21   * See javadoc for ControlLoggerContext.
22   */
23  public class ControlLogger extends MarkerIgnoringBase {
24  
25      private static final long serialVersionUID = 1L;
26      final ControlLogger parent;
27      final String name;
28      Level level;
29  
30      public ControlLogger(String name, ControlLogger parent) {
31          if (name == null) {
32              throw new IllegalArgumentException("name cannot be null");
33          }
34          this.name = name;
35          this.parent = parent;
36      }
37  
38      public String getName() {
39          return name;
40      }
41  
42      public Level getLevel() {
43          return level;
44      }
45  
46      public void setLevel(Level level) {
47          this.level = level;
48      }
49  
50      public final Level getEffectiveLevel() {
51          for (ControlLogger cl = this; cl != null; cl = cl.parent) {
52              if (cl.level != null)
53                  return cl.level;
54          }
55          return null; // If reached will cause an NullPointerException.
56      }
57  
58      public boolean equals(Object o) {
59          if (this == o)
60              return true;
61          if (!(o instanceof ControlLogger))
62              return false;
63  
64          final ControlLogger controlLogger = (ControlLogger) o;
65          return name.equals(controlLogger.name);
66      }
67  
68      public int hashCode() {
69          return name.hashCode();
70      }
71  
72      public final void trace(String o) {
73          if (getEffectiveLevel().levelInt <= Level.TRACE_INT) {
74              throw new UnsupportedOperationException("not yet implemented");
75          }
76      }
77  
78      public void trace(String msg, Throwable t) {
79          // To change body of implemented methods use File | Settings | File Templates.
80      }
81  
82      public void trace(String parameterizedMsg, Object param1) {
83          // To change body of implemented methods use File | Settings | File Templates.
84      }
85  
86      public void trace(String parameterizedMsg, Object param1, Object param2) {
87          // To change body of implemented methods use File | Settings | File Templates.
88      }
89  
90      public final void debug(String o) {
91          if (getEffectiveLevel().levelInt <= Level.DEBUG_INT) {
92              throw new UnsupportedOperationException("not yet implemented");
93          }
94      }
95  
96      public void debug(String msg, Throwable t) {
97          // To change body of implemented methods use File | Settings | File Templates.
98      }
99  
100     public void debug(String parameterizedMsg, Object param1) {
101         // To change body of implemented methods use File | Settings | File Templates.
102     }
103 
104     public void debug(String parameterizedMsg, Object param1, Object param2) {
105         // To change body of implemented methods use File | Settings | File Templates.
106     }
107 
108     public void error(String msg) {
109         // To change body of implemented methods use File | Settings | File Templates.
110     }
111 
112     public void error(String msg, Throwable t) {
113         // To change body of implemented methods use File | Settings | File Templates.
114     }
115 
116     public void error(String parameterizedMsg, Object param1) {
117         // To change body of implemented methods use File | Settings | File Templates.
118     }
119 
120     public void error(String parameterizedMsg, Object param1, Object param2) {
121         // To change body of implemented methods use File | Settings | File Templates.
122     }
123 
124     public void info(String msg) {
125         // To change body of implemented methods use File | Settings | File Templates.
126     }
127 
128     public void info(String msg, Throwable t) {
129         // To change body of implemented methods use File | Settings | File Templates.
130     }
131 
132     public void info(String parameterizedMsg, Object param1) {
133         // To change body of implemented methods use File | Settings | File Templates.
134     }
135 
136     public void info(String parameterizedMsg, Object param1, Object param2) {
137         // To change body of implemented methods use File | Settings | File Templates.
138     }
139 
140     public boolean isTraceEnabled() {
141         return false;
142     }
143 
144     public boolean isDebugEnabled() {
145         return false; // To change body of implemented methods use File | Settings | File Templates.
146     }
147 
148     public boolean isErrorEnabled() {
149         return false; // To change body of implemented methods use File | Settings | File Templates.
150     }
151 
152     public boolean isInfoEnabled() {
153         return false; // To change body of implemented methods use File | Settings | File Templates.
154     }
155 
156     public boolean isWarnEnabled() {
157         return false; // To change body of implemented methods use File | Settings | File Templates.
158     }
159 
160     public void warn(String msg) {
161         // To change body of implemented methods use File | Settings | File Templates.
162     }
163 
164     public void warn(String msg, Throwable t) {
165         // To change body of implemented methods use File | Settings | File Templates.
166     }
167 
168     public void warn(String parameterizedMsg, Object param1) {
169         // To change body of implemented methods use File | Settings | File Templates.
170     }
171 
172     public void warn(String parameterizedMsg, Object param1, Object param2) {
173         // To change body of implemented methods use File | Settings | File Templates.
174     }
175 
176     public void trace(String format, Object... argArray) {
177     }
178 
179     public void debug(String format, Object... argArray) {
180     }
181 
182     public void info(String format, Object... argArray) {
183     }
184 
185     public void warn(String format, Object... argArray) {
186     }
187 
188     public void error(String format, Object... argArray) {
189     }
190 
191 }