Skip to content

Commit

Permalink
Logging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Jan 25, 2020
1 parent 9ceec92 commit bb4d4f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/OrientatedItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ protected function calculateAdditionalItemsPackedWithThisOrientation(
$depthLeft,
$currentRowLengthBeforePacking
) {
$packedCount = 0;

$currentRowLength = max($prevItem->getLength(), $currentRowLengthBeforePacking);

$itemsToPack = $nextItems->topN(8); // cap lookahead as this gets recursive and slow
Expand Down Expand Up @@ -373,9 +371,10 @@ protected function calculateAdditionalItemsPackedWithThisOrientation(
$itemsToPack->remove($packedItem);
}

$packedCount = $nextItems->count() - $itemsToPack->count();
$this->logger->debug('Lookahead with orientation', ['packedCount' => $packedCount, 'orientatedItem' => $prevItem]);

static::$lookaheadCache[$cacheKey] = $nextItems->count() - $itemsToPack->count();
static::$lookaheadCache[$cacheKey] = $packedCount;
}

return static::$lookaheadCache[$cacheKey];
Expand Down
4 changes: 3 additions & 1 deletion src/VolumePacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function __construct(Box $box, ItemList $items)
}

$this->orientatedItemFactory = new OrientatedItemFactory($this->box);
$this->orientatedItemFactory->setLogger($this->logger);
}

/**
Expand Down Expand Up @@ -152,7 +153,7 @@ public function pack()
$this->stabiliseLayers();
}

$this->logger->debug('done with this box');
$this->logger->debug('done with this box ' . $this->box->getReference());

return PackedBox::fromPackedItemList($this->box, $this->getPackedItemList());
}
Expand Down Expand Up @@ -239,6 +240,7 @@ protected function packLayer($startDepth, $widthLeft, $lengthLeft, $depthLeft)
public function stabiliseLayers()
{
$stabiliser = new LayerStabiliser();
$stabiliser->setLogger($this->logger);
$this->layers = $stabiliser->stabilise($this->layers);
}

Expand Down
2 changes: 1 addition & 1 deletion src/WorkingVolume.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(
*/
public function getReference()
{
return 'Working Volume';
return "Working Volume {$this->width}x{$this->length}x{$this->depth}";
}

/**
Expand Down

0 comments on commit bb4d4f3

Please sign in to comment.