From e22b748ce9ecbb7ac92608e4a89d578327effc61 Mon Sep 17 00:00:00 2001 From: luk3yx Date: Fri, 22 Jul 2022 11:40:10 +1200 Subject: [PATCH] Only log large invalid JSON strings when built in debug mode --- src/script/lua_api/l_util.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 3e40b8e33..962d91028 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -109,8 +109,12 @@ int ModApiUtil::l_parse_json(lua_State *L) size_t jlen = strlen(jsonstr); if (jlen > 100) { errorstream << "Data (" << jlen +#ifdef NDEBUG + << " bytes) not printed." << std::endl; +#else << " bytes) printed to warningstream." << std::endl; warningstream << "data: \"" << jsonstr << "\"" << std::endl; +#endif } else { errorstream << "data: \"" << jsonstr << "\"" << std::endl; }