Skip to content

LoggerFactoryInterface

DI-injectable factory for category loggers.

Delegates to the same LogRegistry the Log facade uses, so injected and facade loggers share one configuration.

interface LoggerFactoryInterface

Implemented byLoggerFactory
SourceLogging/LoggerFactoryInterface.php
MethodDescription
create(string $category): LoggerInterfaceReturns a logger bound to the given category name verbatim.
[`for(objectstring $classOrObject): LoggerInterface`](#for)

abstract 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.

ParameterTypeDescription
$categorystring

Returns LoggerInterface

abstract 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.

ParameterTypeDescription
$classOrObject`object““string`

Returns LoggerInterface