1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-24 17:11:33 +00:00

Merge branch 'fix-debug-config' into 'master'

Fix Windows Debug build

See merge request OpenMW/openmw!4629
This commit is contained in:
Alexei Kotov 2025-04-12 17:35:03 +03:00
commit f7f148a6ca

View file

@ -106,6 +106,8 @@ namespace Debug
logListener = std::move(listener);
}
namespace
{
class DebugOutputBase : public boost::iostreams::sink
{
public:
@ -137,7 +139,8 @@ namespace Debug
#endif
prefixSize = std::strftime(prefix + 1, sizeof(prefix) - 1, "%T", &time_info) + 1;
char levelLetter = " EWIVD*"[int(level)];
const auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
const auto ms
= std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
prefixSize += snprintf(prefix + prefixSize, sizeof(prefix) - prefixSize, ".%03u %c] ",
static_cast<unsigned>(ms % 1000), levelLetter);
}
@ -152,7 +155,8 @@ namespace Debug
writeImpl(prefix, prefixSize, level);
writeImpl(msg.data(), lineSize, level);
if (logListener)
logListener(level, std::string_view(prefix, prefixSize), std::string_view(msg.data(), lineSize));
logListener(
level, std::string_view(prefix, prefixSize), std::string_view(msg.data(), lineSize));
msg = msg.substr(lineSize);
}
@ -192,8 +196,6 @@ namespace Debug
};
#else
namespace
{
struct Record
{
std::string mValue;
@ -324,6 +326,7 @@ namespace Debug
First mFirst;
Second mSecond;
};
#endif
Level toLevel(std::string_view value)
{
@ -340,8 +343,6 @@ namespace Debug
return Verbose;
}
}
#endif
static std::unique_ptr<std::ostream> rawStdout = nullptr;
static std::unique_ptr<std::ostream> rawStderr = nullptr;
@ -356,6 +357,7 @@ namespace Debug
static boost::iostreams::stream_buffer<Tee<Buffer, Coloured>> bufferedOut;
static boost::iostreams::stream_buffer<Tee<Buffer, Coloured>> bufferedErr;
#endif
}
std::ostream& getRawStdout()
{