diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-11 14:53:14 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-11 14:53:14 +0200 |
commit | fa319eea94e72e14685d1a9ba9704d55b0d027fb (patch) | |
tree | 22afd60af85c98fc6719c143f28837d938b00e0c /common/log.cpp | |
parent | 8d2f5eee5a5f318243673dbfaf32d8f2325b50f0 (diff) | |
download | sink-fa319eea94e72e14685d1a9ba9704d55b0d027fb.tar.gz sink-fa319eea94e72e14685d1a9ba9704d55b0d027fb.zip |
Dynamically grow the area width
Instead of blindly shortening the area.
Diffstat (limited to 'common/log.cpp')
-rw-r--r-- | common/log.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/log.cpp b/common/log.cpp index 099c043..61ba46a 100644 --- a/common/log.cpp +++ b/common/log.cpp | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <iostream> | 10 | #include <iostream> |
11 | #include <unistd.h> | 11 | #include <unistd.h> |
12 | #include <memory> | 12 | #include <memory> |
13 | #include <atomic> | ||
13 | #include <definitions.h> | 14 | #include <definitions.h> |
14 | 15 | ||
15 | using namespace Sink::Log; | 16 | using namespace Sink::Log; |
@@ -360,7 +361,9 @@ QDebug Sink::Log::debugStream(DebugLevel debugLevel, int line, const char *file, | |||
360 | if (useColor) { | 361 | if (useColor) { |
361 | output += colorCommand(QList<int>() << ANSI_Colors::Bold << prefixColorCode); | 362 | output += colorCommand(QList<int>() << ANSI_Colors::Bold << prefixColorCode); |
362 | } | 363 | } |
363 | output += QString(" %1 ").arg(fullDebugArea.leftJustified(25, ' ', true)); | 364 | static std::atomic<int> maxDebugAreaSize{25}; |
365 | maxDebugAreaSize = qMax(fullDebugArea.size(), maxDebugAreaSize.load()); | ||
366 | output += QString(" %1 ").arg(fullDebugArea.leftJustified(maxDebugAreaSize, ' ', false)); | ||
364 | if (useColor) { | 367 | if (useColor) { |
365 | output += resetColor; | 368 | output += resetColor; |
366 | } | 369 | } |