mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Log: Added support for multi-line log entries, which are split
This commit is contained in:
parent
ebfe7946fb
commit
252fcab570
1 changed files with 11 additions and 0 deletions
11
src/Log.cpp
11
src/Log.cpp
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <Log.h>
|
#include <Log.h>
|
||||||
|
#include <shared.h>
|
||||||
#include <format.h>
|
#include <format.h>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -50,6 +51,16 @@ void Log::write (const std::string& category, const std::string& line)
|
||||||
|
|
||||||
if (line != "")
|
if (line != "")
|
||||||
{
|
{
|
||||||
|
// If line contains newlines, split it into separate lines and log each one.
|
||||||
|
if (line.find ("\n") != std::string::npos)
|
||||||
|
{
|
||||||
|
for (const auto& single : split (line, '\n'))
|
||||||
|
write (category, single);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Single line.
|
||||||
if (line == _prior)
|
if (line == _prior)
|
||||||
{
|
{
|
||||||
++_repetition;
|
++_repetition;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue