Skip to content

Commit

Permalink
fix: simplify logging interations + records
Browse files Browse the repository at this point in the history
Explicitly formatting the message with the record is no longer required, as the context is provided when outputting the logs in the streams of primary concern
  • Loading branch information
keevan committed Jul 24, 2023
1 parent a75a1b8 commit 4d88c30
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 0 additions & 4 deletions classes/local/execution/engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,6 @@ private function setup_logging() {
if (isset($record['context']['step'])) {
$record['message'] = '{step}: ' . $record['message'];
}
if (isset($record['context']['record'])) {
$record['message'] .= ' {record}';
$record['context']['record'] = json_encode($record['context']['record']);
}
return $record;
});

Expand Down
4 changes: 1 addition & 3 deletions classes/local/execution/iterators/dataflow_iterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ public function next($caller) {
$this->stepvars->set('iterations', $this->iterationcount);

// Log the iteration for real steps.
if (!$this->steptype instanceof flow_cap) {
$this->step->log->info('Iteration ' . $this->iterationcount, ['record' => $newvalue]);
}
$this->step->log->info('Iteration ' . $this->iterationcount, (array) $newvalue);
} catch (\Throwable $e) {
$this->step->log->error($e->getMessage());
$this->step->engine->abort();
Expand Down

0 comments on commit 4d88c30

Please sign in to comment.