mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
This commit is contained in:
parent
a73ba9b6b4
commit
4eba469298
@ -33,7 +33,7 @@ if (!isset($logsplit)) {
|
||||
$logsplit = 3;
|
||||
}
|
||||
|
||||
function print_dump($logarr)
|
||||
function print_dump($logarr, $lineCharLimit)
|
||||
{
|
||||
global $config, $logsplit;
|
||||
|
||||
@ -45,6 +45,10 @@ function print_dump($logarr)
|
||||
}
|
||||
|
||||
foreach ($logarr as $logent) {
|
||||
if ($lineCharLimit != 0 && strlen($logent) > $lineCharLimit) {
|
||||
$logent = substr($logent, 0, $lineCharLimit - 1) . '…';
|
||||
}
|
||||
|
||||
$logent = preg_split('/\s+/', $logent);
|
||||
if (count($logent) < $logsplit + 1) {
|
||||
continue;
|
||||
@ -63,14 +67,6 @@ function print_dump($logarr)
|
||||
}
|
||||
}
|
||||
|
||||
function limit_log_line_length(string $line, int $lineCharLimit): string
|
||||
{
|
||||
if (strlen($line) <= $lineCharLimit) {
|
||||
return $line;
|
||||
} else {
|
||||
return substr($line, 0, $lineCharLimit - 1) . '…';
|
||||
}
|
||||
}
|
||||
|
||||
function dump_clog($logfile, $tail, $grepfor = '', int $lineCharLimit = 0)
|
||||
{
|
||||
@ -98,13 +94,7 @@ function dump_clog($logfile, $tail, $grepfor = '', int $lineCharLimit = 0)
|
||||
$logarr = sprintf(gettext('File %s yielded no results.'), $logfile);
|
||||
}
|
||||
|
||||
if ($lineCharLimit != 0) {
|
||||
$logarr = array_map(function($value) use ($lineCharLimit) {
|
||||
return limit_log_line_length($value, $lineCharLimit);
|
||||
}, $logarr);
|
||||
}
|
||||
|
||||
print_dump($logarr);
|
||||
print_dump($logarr, $lineCharLimit);
|
||||
}
|
||||
|
||||
function dump_log($logfile, $tail, $grepfor = '', int $lineCharLimit = 0)
|
||||
@ -133,11 +123,5 @@ function dump_log($logfile, $tail, $grepfor = '', int $lineCharLimit = 0)
|
||||
$logarr = sprintf(gettext('File %s yielded no results.'), $logfile);
|
||||
}
|
||||
|
||||
if ($lineCharLimit != 0) {
|
||||
$logarr = array_map(function($value) use ($lineCharLimit) {
|
||||
return limit_log_line_length($value, $lineCharLimit);
|
||||
}, $logarr);
|
||||
}
|
||||
|
||||
print_dump($logarr);
|
||||
print_dump($logarr, $lineCharLimit);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user