Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Log/composite.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function open(): bool
/* Attempt to open each of our children. */
$this->opened = true;
foreach ($this->children as $child) {
$this->opened = $this->opened && $child->open();
if (!$child->open()) {
$this->opened = false;
}
}

/* If all children were opened, return success. */
Expand All @@ -82,8 +84,8 @@ public function close(): bool
/* Attempt to close each of our children. */
$closed = true;
foreach ($this->children as $child) {
if ($child->opened) {
$closed = $closed && $child->close();
if ($child->opened && !$child->close()) {
$closed = false;
}
}

Expand All @@ -107,7 +109,9 @@ public function flush(): bool
/* Attempt to flush each of our children. */
$flushed = true;
foreach ($this->children as $child) {
$flushed &= $child->flush();
if (!$child->flush()) {
$flushed = false;
}
}

/* If all children were flushed, return success. */
Expand Down Expand Up @@ -169,7 +173,9 @@ public function log($message, ?int $priority = null): bool

/* If this child has yet to be opened, attempt to do so now. */
if (!$child->opened) {
$success &= $child->open();
if (!$child->open()) {
$success = false;
}

/*
* If we've successfully opened our first handler, the
Expand All @@ -181,8 +187,8 @@ public function log($message, ?int $priority = null): bool
}

/* Finally, attempt to log the message to the child handler. */
if ($child->opened) {
$success = $success && $child->log($message, $priority);
if ($child->opened && !$child->log($message, $priority)) {
$success = false;
}
}

Expand Down