From a6add0d8a9a55662fda45cb983c079b1fc00ab42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Mar 2019 00:48:12 +0100 Subject: [PATCH] Debug module debugbar --- htdocs/admin/debugbar.php | 3 ++- .../class/DataCollector/DolLogsCollector.php | 2 +- .../class/DataCollector/DolMemoryCollector.php | 17 +++++++++++++++++ htdocs/langs/en_US/admin.lang | 3 ++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index c55de38f5e2..34cc06c5f08 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -92,7 +92,8 @@ print '\n"; print ''.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").''; -print ''; +print ''; // This slow seriously output +print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput"); print ''; print ''; diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index 74782b0b524..8c03bdc2830 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -32,7 +32,7 @@ class DolLogsCollector extends MessagesCollector parent::__construct($name); $this->path = $path ?: $this->getLogsFile(); - $this->lines = $conf->global->DEBUGBAR_LOGS_LINES_NUMBER ? $conf->global->DEBUGBAR_LOGS_LINES_NUMBER : 1000; + $this->lines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // This slow seriously output } /** diff --git a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php index 4947ef73282..b6525633481 100644 --- a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php @@ -8,6 +8,23 @@ use \DebugBar\DataCollector\MemoryCollector; class DolMemoryCollector extends MemoryCollector { + /** + * Return value of indicator + * + * @return void + */ + public function collect() + { + global $langs; + + $this->updatePeakUsage(); + return array( + 'peak_usage' => $this->peakUsage, + //'peak_usage_str' => $this->getDataFormatter()->formatBytes($this->peakUsage, 2) + 'peak_usage_str' => $this->peakUsage.' '.$langs->trans("bytes") + ); + } + /** * Return widget settings * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fbf37558a8e..3261707579f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1869,4 +1869,5 @@ DebugBarSetup=DebugBar Setup GeneralOptions=General Options LogsLinesNumber=Number of lines to show on logs tab UseDebugBar=Use the debug bar -DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console \ No newline at end of file +DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console +WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output \ No newline at end of file