Changeset 9:8ad424212eed in rrlib_logging-java
- Timestamp:
- 14.07.2019 14:13:34 (22 months ago)
- Branch:
- 17.03
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LogDomain.java
r8 r9 118 118 */ 119 119 void configureSubTree() { 120 if (parent != null && parent.configuration.configureSubTree) {120 if (parent != null) { 121 121 configuration = new LogDomainConfiguration(configuration.name, parent.configuration); 122 122 for (LogDomain ld : children) { … … 177 177 } else if (ls == LogStreamOutput.COMBINED_FILE) { 178 178 LogDomain domain = this; 179 for (; domain.parent != null && domain.parent.configuration.configureSubTree; domain = domain.parent) {}179 for (; domain.parent != null; domain = domain.parent) {} 180 180 tmp.add(domain.openFileOutputStream() ? fileStream : System.err); 181 181 } -
LogDomainConfiguration.java
r0 r9 50 50 51 51 String name; 52 boolean configureSubTree;53 52 54 53 boolean enabled = true; … … 69 68 LogDomainConfiguration(String name, LogDomainConfiguration other) { 70 69 this.name = name; 71 configureSubTree = other.configureSubTree;72 70 enabled = other.enabled; 73 71 printTime = other.printTime; -
LogDomainRegistry.java
r2 r9 154 154 assert(node.getNodeName().equals("domain")); 155 155 156 String prefix = (parentName == "."? "" : parentName) + ".";156 String prefix = (parentName.equals(".") ? "" : parentName) + "."; 157 157 String nodeName = node.getAttributes().getNamedItem("name").getNodeValue().trim(); 158 String name = prefix + (parentName.length() == 0 && nodeName == "global" ? "" : nodeName); 159 160 Node item = node.getAttributes().getNamedItem("configures_sub_tree"); 161 if (item != null) { 162 setDomainConfiguresSubTree(name, item.getNodeValue().trim().toLowerCase().equals("true")); 163 } 164 165 item = node.getAttributes().getNamedItem("enabled"); 158 if (nodeName.equals(".")) { 159 nodeName = ""; 160 } 161 String name = prefix + (parentName.length() == 0 && nodeName.equals("global") ? "" : nodeName); 162 163 Node item = node.getAttributes().getNamedItem("enabled"); 166 164 if (item != null) { 167 165 setDomainIsEnabled(name, item.getNodeValue().trim().toLowerCase().equals("true")); 168 166 } 169 167 170 item = node.getAttributes().getNamedItem("print _time");168 item = node.getAttributes().getNamedItem("prints_time"); 171 169 if (item != null) { 172 170 setDomainPrintsTime(name, item.getNodeValue().trim().toLowerCase().equals("true")); 173 171 } 174 172 175 item = node.getAttributes().getNamedItem("print _name");173 item = node.getAttributes().getNamedItem("prints_name"); 176 174 if (item != null) { 177 175 setDomainPrintsName(name, item.getNodeValue().trim().toLowerCase().equals("true")); 178 176 } 179 177 180 item = node.getAttributes().getNamedItem("print _level");178 item = node.getAttributes().getNamedItem("prints_level"); 181 179 if (item != null) { 182 180 setDomainPrintsLevel(name, item.getNodeValue().trim().toLowerCase().equals("true")); 183 181 } 184 182 185 item = node.getAttributes().getNamedItem("print _location");183 item = node.getAttributes().getNamedItem("prints_location"); 186 184 if (item != null) { 187 185 setDomainPrintsLocation(name, item.getNodeValue().trim().toLowerCase().equals("true")); … … 302 300 } 303 301 304 // TODO: maybe..305 // /** Get the length of the longest full qualified domain name306 // *307 // * This method can be used for formatting user dialogs308 // *309 // * @return The length of the longest domain name310 // */311 // public int GetMaxDomainNameLength() {312 //313 // }314 315 /** Enable a given domain and switch recursion on or off316 *317 * This is a shortcut for setting the configuration of the domain's318 * sub tree and enabling it.319 *320 * @param name The full qualified name of the domain321 */322 public void enableDomain(String name) {323 enableDomain(name, false);324 }325 326 /** Enable a given domain and switch recursion on or off327 *328 * This is a shortcut for setting the configuration of the domain's329 * sub tree and enabling it.330 *331 * @param name The full qualified name of the domain332 * @param withSubTree Switch recursion on or off333 */334 public void enableDomain(String name, boolean withSubTree) {335 setDomainConfiguresSubTree(name, withSubTree);336 setDomainIsEnabled(name, true);337 }338 339 /** Disable a given domain and switch recursion on or off340 *341 * This is a shortcut for setting the configuration of the domain's342 * sub tree and disabling it.343 *344 * @param name The full qualified name of the domain345 */346 public void disableDomain(String name) {347 disableDomain(name, false);348 }349 350 /** Disable a given domain and switch recursion on or off351 *352 * This is a shortcut for setting the configuration of the domain's353 * sub tree and disabling it.354 *355 * @param name The full qualified name of the domain356 * @param withSubTree Switch recursion on or off357 */358 public void disableDomain(String name, boolean withSubTree) {359 setDomainConfiguresSubTree(name, withSubTree);360 setDomainIsEnabled(name, false);361 }362 363 /** Set if the domain configures its subtree or not364 *365 * If set to true every configuration update to the given domain366 * will be propagated to its subtree.367 *368 * @param name The full qualified name of the domain369 * @param value The new value of the setting370 */371 public void setDomainConfiguresSubTree(String name, boolean value) {372 LogDomainConfiguration configuration = getConfigurationByName(name);373 configuration.configureSubTree = value;374 propagateDomainConfigurationToChildren(name);375 }376 377 302 /** Set if the domain is enabled or not 378 303 * … … 493 418 Document doc = dbuilder.parse(fileName); 494 419 495 return configureFromXMLNode(doc.get FirstChild());420 return configureFromXMLNode(doc.getDocumentElement()); 496 421 } catch (Exception e) { 497 422 System.err.println("RRLib Logging: tLoggingDomainRegistry::ConfigureFromFile >> " + e.getMessage()); … … 512 437 */ 513 438 public boolean configureFromXMLNode(Node node) { 514 if ( node.getNodeName() != "rrlib_logging") {439 if (!node.getNodeName().equals("rrlib_logging")) { 515 440 System.err.println("RRLib Logging: tLoggingDomainRegistry::ConfigureFromXMLNode >> Unexpected content (Not an rrlib_logging tree)"); 516 441 return false;
Note: See TracChangeset
for help on using the changeset viewer.