LoggerFactory
Default LoggerFactoryInterface: thin wrapper over the Log facade (and thus LogRegistry) for constructor injection via the DI container.
Synopsis
Section titled “Synopsis”final class LoggerFactory implements LoggerFactoryInterface
| Implements | LoggerFactoryInterface |
| Source | Logging/LoggerFactory.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
create(string $category): LoggerInterface | Returns a logger bound to the given category name verbatim. |
| [`for(object | string $classOrObject): LoggerInterface`](#for) |
create()
Section titled “create()”public function create(string $category): LoggerInterface
Returns a logger bound to the given category name verbatim.
Implementations must return a logger whose threshold and sinks come from the same configuration the Log facade uses, so an injected logger and a facade logger for the same category behave identically.
| Parameter | Type | Description |
|---|---|---|
$category | string |
Returns LoggerInterface
public function for(object|string $classOrObject): LoggerInterface
Returns a logger whose category is derived from a class name or instance.
Accepts either the object itself or its fully-qualified class name; implementations must map both to the same category.
| Parameter | Type | Description |
|---|---|---|
$classOrObject | `object“ | “string` |
Returns LoggerInterface