From b4511e2e2ed1a6077ae6826a9ee6b7a311293d08 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 25 Aug 2020 20:22:28 +0000 Subject: log: Prefix log messages with function name if -logsourcelocations is set --- src/util/string.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/util') diff --git a/src/util/string.h b/src/util/string.h index 5ffdc80d88..b26facc502 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -25,6 +25,14 @@ return str.substr(front, end - front + 1); } +[[nodiscard]] inline std::string RemovePrefix(const std::string& str, const std::string& prefix) +{ + if (str.substr(0, prefix.size()) == prefix) { + return str.substr(prefix.size()); + } + return str; +} + /** * Join a list of items * -- cgit v1.2.3