Skip to content

Commit

Permalink
Logging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Jan 26, 2020
1 parent 460ca45 commit f38e794
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 @@ -286,8 +286,6 @@ protected function calculateAdditionalItemsPackedWithThisOrientation(
int $depthLeft,
int $currentRowLengthBeforePacking
): int {
$packedCount = 0;

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

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

$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 @@ -110,6 +110,7 @@ public function __construct(Box $box, ItemList $items)
}

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

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

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

return new PackedBox($this->box, $this->getPackedItemList());
}
Expand Down Expand Up @@ -233,6 +234,7 @@ protected function packLayer(int $startDepth, int $widthLeft, int $lengthLeft, i
public function stabiliseLayers(): void
{
$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 @@ -53,7 +53,7 @@ public function __construct(

public function getReference(): string
{
return 'Working Volume';
return "Working Volume {$this->width}x{$this->length}x{$this->depth}";
}

public function getOuterWidth(): int
Expand Down

0 comments on commit f38e794

Please sign in to comment.