001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.control; 015 016import org.slf4j.helpers.MarkerIgnoringBase; 017 018import ch.qos.logback.classic.Level; 019 020/** 021 * See javadoc for ControlLoggerContext. 022 */ 023public class ControlLogger extends MarkerIgnoringBase { 024 025 private static final long serialVersionUID = 1L; 026 final ControlLogger parent; 027 final String name; 028 Level level; 029 030 public ControlLogger(String name, ControlLogger parent) { 031 if (name == null) { 032 throw new IllegalArgumentException("name cannot be null"); 033 } 034 this.name = name; 035 this.parent = parent; 036 } 037 038 public String getName() { 039 return name; 040 } 041 042 public Level getLevel() { 043 return level; 044 } 045 046 public void setLevel(Level level) { 047 this.level = level; 048 } 049 050 public final Level getEffectiveLevel() { 051 for (ControlLogger cl = this; cl != null; cl = cl.parent) { 052 if (cl.level != null) 053 return cl.level; 054 } 055 return null; // If reached will cause an NullPointerException. 056 } 057 058 public boolean equals(Object o) { 059 if (this == o) 060 return true; 061 if (!(o instanceof ControlLogger)) 062 return false; 063 064 final ControlLogger controlLogger = (ControlLogger) o; 065 return name.equals(controlLogger.name); 066 } 067 068 public int hashCode() { 069 return name.hashCode(); 070 } 071 072 public final void trace(String o) { 073 if (getEffectiveLevel().levelInt <= Level.TRACE_INT) { 074 throw new UnsupportedOperationException("not yet implemented"); 075 } 076 } 077 078 public void trace(String msg, Throwable t) { 079 // To change body of implemented methods use File | Settings | File Templates. 080 } 081 082 public void trace(String parameterizedMsg, Object param1) { 083 // To change body of implemented methods use File | Settings | File Templates. 084 } 085 086 public void trace(String parameterizedMsg, Object param1, Object param2) { 087 // To change body of implemented methods use File | Settings | File Templates. 088 } 089 090 public final void debug(String o) { 091 if (getEffectiveLevel().levelInt <= Level.DEBUG_INT) { 092 throw new UnsupportedOperationException("not yet implemented"); 093 } 094 } 095 096 public void debug(String msg, Throwable t) { 097 // To change body of implemented methods use File | Settings | File Templates. 098 } 099 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}