1 package cz.cuni.amis.pogamut.base.utils.logging; 2 3 import java.util.Map; 4 import java.util.logging.Level; 5 6 7 import com.google.inject.ImplementedBy; 8 9 @ImplementedBy(LogCategories.class) 10 public interface ILogCategories { 11 12 /** 13 * Whether some category with specified name exists. 14 * @param name 15 * @return 16 */ 17 public boolean hasCategory(String name); 18 19 /** 20 * Returns IMMUTABLE mapping of categories names to instances of those log categories. 21 * <p><p> 22 * It does not contain instance of {@link IAgentLogger}. 23 * 24 * @return 25 */ 26 public Map<String, LogCategory> getCategories(); 27 28 /** 29 * Adds log category from outside of the object. 30 * 31 * @param name 32 * @param category 33 */ 34 public void addLogCategory(String name, LogCategory category); 35 36 /** 37 * Returns names of all existing log categories. 38 * @return 39 */ 40 public String[] getCategoryNames(); 41 42 /** 43 * Returns names of all existing log categories sorted alphabetically. 44 * @return 45 */ 46 public String[] getCategoryNamesSorted(); 47 48 /** 49 * Returns existing category by the name or adds new one. 50 * <p><p> 51 * Note that new category doesn't have any handler appended, 52 * you have to create at least one for the category to produce something. 53 * <p> 54 * Example:<p> 55 * <code> 56 * LogCategory myCategory = categories.getCategory("my log"); // create new category<br/> 57 * myCategory.newHandler(new LogPublisher.ConsolePublisher()); // add new handler with output to the console 58 * </code> 59 * @param name 60 * @return 61 */ 62 public LogCategory getCategory(String name); 63 64 /** 65 * Set level for all handlers of all categories. 66 * 67 * @param newLevel 68 */ 69 public void setLevel(Level newLevel); 70 71 }