Skip to content

Commit

Permalink
Merged PR 59153: Modify log output to indicate sync process more clearly
Browse files Browse the repository at this point in the history
## What's being changed

The log output for the recently refactored syncs is being adjusted to make it a little bit quieter, and hopefully a little easier to parse and identify the different stages.

Log output for a 2-website sync would now look like this:
```
[2024-10-21T11:42:39.108438+00:00] dotdigital.INFO: Order sync: syncing website 1 [] []
[2024-10-21T11:42:43.052070+00:00] dotdigital.INFO: Order sync: 41 orders processed, 36 selected [] []
[2024-10-21T11:42:43.636881+00:00] dotdigital.INFO: Import id abc pushed to Dotdigital [] []
[2024-10-21T11:42:43.740471+00:00] dotdigital.INFO: 36 orders records batched for website id 1 [] []
[2024-10-21T11:42:44.223513+00:00] dotdigital.INFO: Order sync: syncing website 2 [] []
[2024-10-21T11:42:46.084873+00:00] dotdigital.INFO: Order sync: 50 orders processed, 47 selected [] []
[2024-10-21T11:42:46.409978+00:00] dotdigital.INFO: Order sync: 4 orders processed, 4 selected [] []
[2024-10-21T11:42:47.677370+00:00] dotdigital.INFO: Import id xyz pushed to Dotdigital [] []
[2024-10-21T11:42:47.714536+00:00] dotdigital.INFO: 51 orders records batched for website id 2 [] []
[2024-10-21T11:42:47.813894+00:00] dotdigital.INFO: ----------- Order sync ----------- : 00:00:08, Total processed = 95, Total synced = 87 [] []
```

## Why it's being changed

The big 'title' log lines like:
```
dotdigital.INFO: ----------- Order sync ----------- :
```
should I think only be for a final _summary_ of the relevant sync.

## How to review / test this change

- Reset your customers, subscribers, guests and orders
- Set cron to run
- Observe the log output

Related work items: #273626
  • Loading branch information
sta1r committed Oct 22, 2024
1 parent d8d0aac commit 1dd7721
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Model/Sync/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private function loopByWebsite(WebsiteInterface $website, int $megaBatchSize, in
if ($loopStart) {
$this->logger->info(
sprintf(
'----------- %s sync ----------- : Website %d',
'%s sync: syncing website %d',
Importer::IMPORT_TYPE_CUSTOMER,
$website->getId()
)
Expand Down Expand Up @@ -234,7 +234,7 @@ private function loopByWebsite(WebsiteInterface $website, int $megaBatchSize, in
$offset = 0;
}
} while (!$breakValue || $this->totalCustomersSyncedCount < $breakValue);

$this->megaBatchProcessorFactory->create()
->process(
$megaBatch,
Expand Down
2 changes: 1 addition & 1 deletion Model/Sync/Guest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private function loopByWebsite(Website $website, int $megaBatchSize, int $breakV
if ($loopStart) {
$this->logger->info(
sprintf(
'----------- %s sync ----------- : Website %d',
'%s sync: syncing website %d',
Importer::IMPORT_TYPE_GUEST,
$website->getId()
)
Expand Down
2 changes: 1 addition & 1 deletion Model/Sync/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private function processWebsiteOrders(WebsiteInterface $website)

if ($loopStart) {
$this->logger->info(
sprintf('----------- Order sync ----------- : Website %d', $website->getId())
sprintf('Order sync: syncing website %d', $website->getId())
);
$loopStart = false;
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Sync/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private function exportAndBatch(
if ($this->$loopStart) {
$this->logger->info(
sprintf(
'----------- %s sync ----------- : Website %d',
'%s sync: syncing website %d',
$prettyCohortName,
$website->getId()
)
Expand Down

0 comments on commit 1dd7721

Please sign in to comment.