Skip to content

Commit 068c689

Browse files
committed
fix logging limit #746
1 parent ef6c7ed commit 068c689

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

inc/logger.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private function tailCustom( $filepath, $lines = 1, $adaptive = true, $separator
184184

185185
$buffer = min( $buffer * 2, 4096 );
186186
}
187-
187+
$pos = -1;
188188
if ( ! empty( $separator ) && $separator_found ) {
189189
$pos = strrpos( $output, $separator );
190190
if ( $pos !== false ) {
@@ -197,7 +197,10 @@ private function tailCustom( $filepath, $lines = 1, $adaptive = true, $separator
197197
if ( empty( $separator ) || ! $separator_found ) {
198198
$output = implode( "\n", array_slice( $output_lines, -$lines ) ); // fetch last n lines
199199
} else {
200-
$output = implode( "\n", array_slice( $output_lines, 0, $lines ) ); // fetch from separator
200+
// Calculate the start position for slicing
201+
$start_pos = max( $pos + 1, count( $output_lines ) - $lines );
202+
203+
$output = implode( "\n", array_slice( $output_lines, $start_pos, $lines ) ); // fetch from separator
201204
}
202205

203206
fclose( $f );

0 commit comments

Comments
 (0)