From f63ccbd93640bfd1c8bb8aa68f1ed1b0e0a91e58 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Jul 2018 15:42:42 -0400 Subject: logging/filter: Use std::string_view in ParseFilterString() Allows avoiding constructing std::string instances, since this only reads an arbitrary sequence of characters. We can also make ParseFilterRule() internal, since it doesn't depend on any private instance state of Filter --- src/common/logging/filter.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/common/logging/filter.h') diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index 2a4f7c845..d5ffc5a58 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include "common/logging/log.h" namespace Log { @@ -40,9 +40,7 @@ public: * - `Service:Info` -- Sets the level of Service to Info. * - `Service.FS:Trace` -- Sets the level of the Service.FS class to Trace. */ - void ParseFilterString(const std::string& filter_str); - bool ParseFilterRule(const std::string::const_iterator start, - const std::string::const_iterator end); + void ParseFilterString(std::string_view filter_view); /// Matches class/level combination against the filter, returning true if it passed. bool CheckMessage(Class log_class, Level level) const; -- cgit v1.2.3