src/hotspot/share/logging/logSelection.cpp
changeset 49163 580bb0b85f63
parent 49016 ea85eed8b012
child 49180 9637557def32
equal deleted inserted replaced
49162:c200b4700aeb 49163:580bb0b85f63
    70 static LogSelection parse_internal(char *str, outputStream* errstream) {
    70 static LogSelection parse_internal(char *str, outputStream* errstream) {
    71   // Parse the level, if specified
    71   // Parse the level, if specified
    72   LogLevelType level = LogLevel::Unspecified;
    72   LogLevelType level = LogLevel::Unspecified;
    73   char* equals = strchr(str, '=');
    73   char* equals = strchr(str, '=');
    74   if (equals != NULL) {
    74   if (equals != NULL) {
    75     level = LogLevel::from_string(equals + 1);
    75     const char* levelstr = equals + 1;
       
    76     level = LogLevel::from_string(levelstr);
    76     if (level == LogLevel::Invalid) {
    77     if (level == LogLevel::Invalid) {
    77       if (errstream != NULL) {
    78       if (errstream != NULL) {
    78         errstream->print_cr("Invalid level '%s' in log selection.", equals + 1);
    79         errstream->print("Invalid level '%s' in log selection.", levelstr);
       
    80         LogLevelType match = LogLevel::fuzzy_match(levelstr);
       
    81         if (match != LogLevel::Invalid) {
       
    82           errstream->print(" Did you mean '%s'?", LogLevel::name(match));
       
    83         }
       
    84         errstream->cr();
    79       }
    85       }
    80       return LogSelection::Invalid;
    86       return LogSelection::Invalid;
    81     }
    87     }
    82     *equals = '\0';
    88     *equals = '\0';
    83   }
    89   }
   107       *plus_pos = '\0';
   113       *plus_pos = '\0';
   108     }
   114     }
   109     LogTagType tag = LogTag::from_string(cur_tag);
   115     LogTagType tag = LogTag::from_string(cur_tag);
   110     if (tag == LogTag::__NO_TAG) {
   116     if (tag == LogTag::__NO_TAG) {
   111       if (errstream != NULL) {
   117       if (errstream != NULL) {
   112         errstream->print_cr("Invalid tag '%s' in log selection.", cur_tag);
   118         errstream->print("Invalid tag '%s' in log selection.", cur_tag);
       
   119         LogTagType match =  LogTag::fuzzy_match(cur_tag);
       
   120         if (match != LogTag::__NO_TAG) {
       
   121           errstream->print(" Did you mean '%s'?", LogTag::name(match));
       
   122         }
       
   123         errstream->cr();
   113       }
   124       }
   114       return LogSelection::Invalid;
   125       return LogSelection::Invalid;
   115     }
   126     }
   116     if (ntags == LogTag::MaxTags) {
   127     if (ntags == LogTag::MaxTags) {
   117       if (errstream != NULL) {
   128       if (errstream != NULL) {