Skip to content

Commit 24ce687

Browse files
committed
Add logging
1 parent c36a0b1 commit 24ce687

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

composer.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/Database.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,7 @@ public function deleteCollection(string $id): bool
14991499
*/
15001500
public function createAttribute(string $collection, string $id, string $type, int $size, bool $required, mixed $default = null, bool $signed = true, bool $array = false, ?string $format = null, array $formatOptions = [], array $filters = []): bool
15011501
{
1502+
$tt1 = \microtime(true);
15021503
$collection = $this->silent(fn () => $this->getCollection($collection));
15031504

15041505
if ($collection->isEmpty()) {
@@ -1577,8 +1578,11 @@ public function createAttribute(string $collection, string $id, string $type, in
15771578
}
15781579

15791580
try {
1581+
$t1 = \microtime(true);
15801582
$created = $this->adapter->createAttribute($collection->getId(), $id, $type, $size, $signed, $array);
1581-
1583+
$t2 = \microtime(true);
1584+
$diff = $t2 - $t1;
1585+
\var_dump("Create (" . $diff . "s): " . $collection->getId() . " - " . $id);
15821586
if (!$created) {
15831587
throw new DatabaseException('Failed to create attribute');
15841588
}
@@ -1598,6 +1602,9 @@ public function createAttribute(string $collection, string $id, string $type, in
15981602

15991603
$this->trigger(self::EVENT_ATTRIBUTE_CREATE, $attribute);
16001604

1605+
$tt2 = microtime(true);
1606+
$diff2 = $tt2 - $tt1;
1607+
\var_dump("Total (" . $diff2 . "s): " . $collection->getId() . " - " . $id);
16011608
return true;
16021609
}
16031610

0 commit comments

Comments
 (0)