diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-05-10 17:13:55 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-11 14:51:38 +0200 |
commit | 7b61926fd6704dd244682a965c17e7141ffc1fc5 (patch) | |
tree | fd75628806f83e8d05f769ba4e6defd4beb656fd /vcl | |
parent | 24876e5611abbaec9b2fe5fcbcf4be71a10ee366 (diff) |
lok: dumpState should truncate very long JSON messages.
Otherwise we get huge dumps which can overwhelm our logging and hide
more useful information, and/or the journal can drop them on the ground.
Change-Id: Ie942c70a90a6df60ccd8986444362d622c213e15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167488
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/svapp.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 79b8f5873df8..34b2774995f1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1758,11 +1758,17 @@ void dumpState(rtl::OStringBuffer &rState) vcl::Window *pWin = Application::GetFirstTopLevelWindow(); while (pWin) { - tools::JsonWriter props; - pWin->DumpAsPropertyTree(props); + tools::JsonWriter aProps; + pWin->DumpAsPropertyTree(aProps); rState.append("\n\tWindow: "); - rState.append(props.finishAndGetAsOString()); + OString aPropStr = aProps.finishAndGetAsOString(); + if (aPropStr.getLength() > 256) + { + rState.append(aPropStr.subView(0, 256)); + rState.append("..."); + } else + rState.append(aPropStr); pWin = Application::GetNextTopLevelWindow( pWin ); } |