Skip to content

Commit

Permalink
feat: update LoggerRecipe with nb loaded items since last flush
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolaszek committed Dec 5, 2023
1 parent 4531cbc commit 9260690
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Recipe/LoggerRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public function decorate(EtlExecutor $executor): EtlExecutor
->onFlush(
fn (FlushEvent $event) => $this->log(
$event,
$event->early ? 'Flushing items (early)...' : 'Flushing items...',
$event->early ? 'Flushing {nb} items (early)...' : 'Flushing {nb} items...',
[
'key' => $event->state->currentItemKey,
'nb' => $event->state->nbLoadedItemsSinceLastFlush,
'state' => $event->state,
],
),
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Recipe/LoggerRecipeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
fn ($record) => $record->message->toContain('Extracting item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Transformed item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Loaded item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Flushing items (early)...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('Flushing {nb} items (early)...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('Extracting item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Transformed item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Loaded item')->and($record->level->toBe(Level::Debug)),
fn ($record) => $record->message->toContain('Flushing items (early)...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('Flushing items...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('Flushing {nb} items (early)...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('Flushing {nb} items...')->and($record->level->toBe(Level::Info)),
fn ($record) => $record->message->toContain('ETL complete.')->and($record->level->toBe(Level::Info)),
);
});

0 comments on commit 9260690

Please sign in to comment.