diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 12:24:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 18:25:31 +0200 |
commit | 04aafba860f613c20e7078d038cc83eb02de0b54 (patch) | |
tree | 8153152b87089419bde17313d9ac7b9de6fcce32 /extensions/source/logging/simpletextformatter.cxx | |
parent | 76c793d2acf66f46e9edcda43d2f4327e8374841 (diff) |
loplugin:stringadd simplify some *StringBuffer operations
pulled from a larger patch which I created with a more permissive
variant of this plugin
Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source/logging/simpletextformatter.cxx')
-rw-r--r-- | extensions/source/logging/simpletextformatter.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/extensions/source/logging/simpletextformatter.cxx b/extensions/source/logging/simpletextformatter.cxx index 83416e61c7d6..71e40a362562 100644 --- a/extensions/source/logging/simpletextformatter.cxx +++ b/extensions/source/logging/simpletextformatter.cxx @@ -61,17 +61,14 @@ OUString SAL_CALL SimpleTextFormatter::getHead() { return OUString(); } OUString SAL_CALL SimpleTextFormatter::format(const LogRecord& _rRecord) { - OUStringBuffer aLogEntry; + OUString aLogEntry; // Highlight warnings if (_rRecord.Level == css::logging::LogLevel::SEVERE) - aLogEntry.append("ERROR: "); - if (_rRecord.Level == css::logging::LogLevel::WARNING) - aLogEntry.append("WARNING: "); + aLogEntry = "ERROR: "; + else if (_rRecord.Level == css::logging::LogLevel::WARNING) + aLogEntry = "WARNING: "; - aLogEntry.append(_rRecord.Message); - aLogEntry.append("\n"); - - return aLogEntry.makeStringAndClear(); + return aLogEntry + _rRecord.Message + "\n"; } OUString SAL_CALL SimpleTextFormatter::getTail() { return OUString(); } |