diff --git a/src/log_format.cc b/src/log_format.cc index 4aeac8c0..352b7205 100644 --- a/src/log_format.cc +++ b/src/log_format.cc @@ -108,7 +108,8 @@ logline::level_t logline::string2level(const char *levelstr, ssize_t len, bool e pcre_context_static<10> pc; if (LEVEL_RE.match(pc, pi)) { - retval = abbrev2level(pi.get_substr_start(pc.begin()), len); + auto iter = pc.begin(); + retval = abbrev2level(pi.get_substr_start(iter), pi.get_substr_len(iter)); } return retval; diff --git a/src/pcrepp.hh b/src/pcrepp.hh index d8833096..efefae05 100644 --- a/src/pcrepp.hh +++ b/src/pcrepp.hh @@ -227,6 +227,11 @@ public: return &this->pi_string[iter->c_begin]; }; + size_t get_substr_len(pcre_context::const_iterator iter) const + { + return iter->length(); + }; + std::string get_substr(pcre_context::const_iterator iter) const { if (iter->c_begin == -1) {