src/hotspot/share/logging/logConfiguration.cpp
changeset 49016 ea85eed8b012
parent 49015 a12c9536d8a6
child 49180 9637557def32
--- a/src/hotspot/share/logging/logConfiguration.cpp	Mon Feb 19 09:16:04 2018 +0100
+++ b/src/hotspot/share/logging/logConfiguration.cpp	Mon Feb 19 09:46:10 2018 +0100
@@ -30,8 +30,8 @@
 #include "logging/logDiagnosticCommand.hpp"
 #include "logging/logFileOutput.hpp"
 #include "logging/logOutput.hpp"
+#include "logging/logSelectionList.hpp"
 #include "logging/logStream.hpp"
-#include "logging/logTagLevelExpression.hpp"
 #include "logging/logTagSet.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
@@ -207,7 +207,7 @@
   delete output;
 }
 
-void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators) {
+void LogConfiguration::configure_output(size_t idx, const LogSelectionList& selections, const LogDecorators& decorators) {
   assert(ConfigurationLock::current_thread_has_lock(), "Must hold configuration lock to call this function.");
   assert(idx < _n_outputs, "Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs);
   LogOutput* output = _outputs[idx];
@@ -217,7 +217,7 @@
 
   bool enabled = false;
   for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
-    LogLevelType level = tag_level_expression.level_for(*ts);
+    LogLevelType level = selections.level_for(*ts);
 
     // Ignore tagsets that do not, and will not log on the output
     if (!ts->has_output(output) && (level == LogLevel::NotMentioned || level == LogLevel::Off)) {
@@ -299,11 +299,11 @@
 void LogConfiguration::configure_stdout(LogLevelType level, int exact_match, ...) {
   size_t i;
   va_list ap;
-  LogTagLevelExpression expr;
+  LogTagType tags[LogTag::MaxTags];
   va_start(ap, exact_match);
   for (i = 0; i < LogTag::MaxTags; i++) {
     LogTagType tag = static_cast<LogTagType>(va_arg(ap, int));
-    expr.add_tag(tag);
+    tags[i] = tag;
     if (tag == LogTag::__NO_TAG) {
       assert(i > 0, "Must specify at least one tag!");
       break;
@@ -313,17 +313,14 @@
          "Too many tags specified! Can only have up to " SIZE_FORMAT " tags in a tag set.", LogTag::MaxTags);
   va_end(ap);
 
-  if (!exact_match) {
-    expr.set_allow_other_tags();
-  }
-  expr.set_level(level);
-  expr.new_combination();
-  assert(expr.verify_tagsets(),
-         "configure_stdout() called with invalid/non-existing tag set");
+  LogSelection selection(tags, !exact_match, level);
+  assert(selection.tag_sets_selected() > 0,
+         "configure_stdout() called with invalid/non-existing log selection");
+  LogSelectionList list(selection);
 
   // Apply configuration to stdout (output #0), with the same decorators as before.
   ConfigurationLock cl;
-  configure_output(0, expr, _outputs[0]->decorators());
+  configure_output(0, list, _outputs[0]->decorators());
   notify_update_listeners();
 }
 
@@ -382,7 +379,7 @@
 }
 
 bool LogConfiguration::parse_log_arguments(const char* outputstr,
-                                           const char* what,
+                                           const char* selectionstr,
                                            const char* decoratorstr,
                                            const char* output_options,
                                            outputStream* errstream) {
@@ -391,8 +388,8 @@
     outputstr = "stdout";
   }
 
-  LogTagLevelExpression expr;
-  if (!expr.parse(what, errstream)) {
+  LogSelectionList selections;
+  if (!selections.parse(selectionstr, errstream)) {
     return false;
   }
 
@@ -433,9 +430,9 @@
       return false;
     }
   }
-  configure_output(idx, expr, decorators);
+  configure_output(idx, selections, decorators);
   notify_update_listeners();
-  expr.verify_tagsets(errstream);
+  selections.verify_selections(errstream);
   return true;
 }