Admin: introduce docstats subsection in logging in config

Change-Id: Icccc9d842703b3159965f67be2bf16404d50bad6
Signed-off-by: Yunusemre Şentürk <yunusemre@collabora.com>
pull/4010/head
Yunusemre Şentürk 2022-01-12 09:03:07 +03:00 committed by Michael Meeks
parent 80fa18f177
commit 2314c40873
2 changed files with 13 additions and 5 deletions

View File

@ -83,6 +83,7 @@
<anonymize_user_data type="bool" desc="Enable to anonymize/obfuscate of user-data in logs. If default is true, it was forced at compile-time and cannot be disabled." default="@COOLWSD_ANONYMIZE_USER_DATA@">@COOLWSD_ANONYMIZE_USER_DATA@</anonymize_user_data>
<anonymization_salt type="uint" desc="The salt used to anonymize/obfuscate user-data in logs. Use a secret 64-bit random number." default="82589933">82589933</anonymization_salt>
</anonymize>
<docstats type="bool" desc="Enable to see document handling information in logs." default="false">false</docstats>
</logging>
<!--

View File

@ -551,11 +551,18 @@ void AdminModel::addDocument(const std::string& docKey, pid_t pid,
}
oss << memoryAllocated << ' ' << wopiHost;
LOG_INF("Adding a new document : " << filename
<< " created by : " << COOLWSD::anonymizeUsername(userName)
<< " using WopiHost : " << COOLWSD::anonymizeUrl(wopiHost)
<< " allocating memory of : " << memoryAllocated);
if (COOLWSD::getConfigValue<bool>("logging.docstats", false))
{
Log::StreamLogger logger = Log::trace();
if (logger.enabled())
{
logger << "docstats : adding a document : " << filename
<< " created by : " << COOLWSD::anonymizeUsername(userName)
<< " using WopiHost : " << COOLWSD::anonymizeUrl(wopiHost)
<< " allocating memory of : " << memoryAllocated;
}
logger.flush();
}
notify(oss.str());
}