diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-05-10 17:13:55 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2024-05-10 21:25:15 +0200 |
commit | b1c77f927aced5eeaebd5c17c30efdc1df74c4f9 (patch) | |
tree | 49bb491f88c98ec0625a5ca338ed14cb042c9301 | |
parent | 4425741937fbd240fe414a68a7d5e9ac4b40affd (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/+/167456
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-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 8bfcb5e03d66..b3a63cd05a46 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1750,11 +1750,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 ); } |