aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-08-25 20:22:28 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2021-01-15 09:57:32 +0000
commitb4511e2e2ed1a6077ae6826a9ee6b7a311293d08 (patch)
treeb6191e31029db4e1e517f93e4af119015d159c2e /src/util
parent29d2aeb4a2b1830be4724aab3a84a62f072056f4 (diff)
log: Prefix log messages with function name if -logsourcelocations is set
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string.h8
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
*