Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
only log diagnostic events if a treshhold is set
this prevents log spam and it's rare that you actually want to very short events logged anyway

Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed May 16, 2022
commit 30b0a0272b62775e9f23b9d4ba5cee7d9d678a5a
2 changes: 2 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2128,6 +2128,8 @@

/**
* Limit diagnostics event logging to events longer than the configured threshold in ms
*
* when set to 0 no diagnostics events will be logged
*/
'diagnostics.logging.threshold' => 0,

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Diagnostics/EventLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function writeLog(IEvent $event) {
$timeInMs = round($duration * 1000, 4);

$loggingMinimum = (int)$this->config->getValue('diagnostics.logging.threshold', 0);
if ($loggingMinimum > 0 && $timeInMs < $loggingMinimum) {
if ($loggingMinimum === 0 || $timeInMs < $loggingMinimum) {
return;
}

Expand Down