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