diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-08-25 20:22:28 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2021-01-15 09:57:32 +0000 |
commit | b4511e2e2ed1a6077ae6826a9ee6b7a311293d08 (patch) | |
tree | b6191e31029db4e1e517f93e4af119015d159c2e /src/util | |
parent | 29d2aeb4a2b1830be4724aab3a84a62f072056f4 (diff) |
log: Prefix log messages with function name if -logsourcelocations is set
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/string.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 * |