From f3943934a73960080b6d304c70d1d0a19f694af8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 18 Jul 2019 13:34:52 +0200 Subject: [PATCH] [util] Improve multi-line logging --- src/util/log/log.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util/log/log.cpp b/src/util/log/log.cpp index f55f6df4..b89edcd1 100644 --- a/src/util/log/log.cpp +++ b/src/util/log/log.cpp @@ -52,8 +52,14 @@ namespace dxvk { = {{ "trace: ", "debug: ", "info: ", "warn: ", "err: " }}; const char* prefix = s_prefixes.at(static_cast(level)); - std::cerr << prefix << message << std::endl; - m_fileStream << prefix << message << std::endl; + + std::stringstream stream(message); + std::string line; + + while (std::getline(stream, line, '\n')) { + std::cerr << prefix << line << std::endl; + m_fileStream << prefix << line << std::endl; + } } }