1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.env.log.Logger; 18 import org.as2lib.env.log.LogLevel; 19 import org.as2lib.env.log.LogHandler; 20 21 /** 22 * {@code ConfigurableLogger} declares methods needed to configure most loggers. 23 * 24 * <p>This is first the method to set the level {@link #setLevel} and second the 25 * methods to add, remove and access handlers {@link #addHandler}, 26 * {@link #removeHandler}, {@link #removeAllHandlers} and {@link #getAllHandlers}. 27 * 28 * <p>Log handlers are responsible for making the actual output. There are a few 29 * pre-defined handlers that can be used to log to different output devices. Take 30 * a look at the {@code org.as2lib.env.log.handler} package for these. 31 * 32 * <p>Loggers are normally configured only once. 33 * 34 * @author Simon Wacker 35 */ 36 interface org.as2lib.env.log.ConfigurableLogger extends Logger { 37 38 /** 39 * Returns the set level. 40 * 41 * @return the set level 42 * @see #setLevel 43 */ 44 public function getLevel(Void):LogLevel; 45 46 /** 47 * Sets the log level. 48 * 49 * <p>The level determines which output to make and and which to make not. 50 * 51 * @param level the new level to control the output 52 * @see #getLevel 53 */ 54 public function setLevel(level:LogLevel):Void; 55 56 /** 57 * Adds the passed-in log {@code handler}. 58 * 59 * <p>Log handlers are used to actually log the messages. They determine what 60 * information to log and to which output device. 61 * 62 * @param handler the new log handler to log messages 63 */ 64 public function addHandler(handler:LogHandler):Void; 65 66 /** 67 * Returns all handlers that were added to this logger. 68 * 69 * @return all added log handlers 70 */ 71 public function getAllHandlers(Void):Array; 72 73 /** 74 * Removes all occerrences of the passed-in {@code handler}. 75 * 76 * @param handler the log handler to remove 77 */ 78 public function removeHandler(handler:LogHandler):Void; 79 80 /** 81 * Removes all added log handlers. 82 */ 83 public function removeAllHandlers(Void):Void; 84 85 }