$loggers
$loggers : array<mixed,\Monolog\Logger>
List of all loggers in the registry (by named indexes)
Monolog log registry
Allows to get Logger
instances in the global scope
via static method calls on this class.
$application = new Monolog\Logger('application');
$api = new Monolog\Logger('api');
Monolog\Registry::addLogger($application); Monolog\Registry::addLogger($api);
function testLogger() { Monolog\Registry::api()->addError('Sent to $api Logger instance'); Monolog\Registry::application()->addError('Sent to $application Logger instance'); }
$loggers : array<mixed,\Monolog\Logger>
List of all loggers in the registry (by named indexes)
addLogger(\Monolog\Logger $logger, string|null $name = null, boolean $overwrite = false)
Adds new logging channel to the registry
\Monolog\Logger | $logger | Instance of the logging channel |
string|null | $name | Name of the logging channel ($logger->getName() by default) |
boolean | $overwrite | Overwrite instance in the registry if the given name already exists? |
If $overwrite set to false and named Logger instance already exists
hasLogger(string|\Monolog\Logger $logger)
Checks if such logging channel exists by name or instance
string|\Monolog\Logger | $logger | Name or logger instance |
removeLogger(string|\Monolog\Logger $logger)
Removes instance from registry by name or instance
string|\Monolog\Logger | $logger | Name or logger instance |
getInstance(string $name) : \Monolog\Logger
Gets Logger instance from the registry
string | $name | Name of the requested Logger instance |
If named Logger instance is not in the registry
Requested instance of Logger
__callStatic(string $name, array $arguments) : \Monolog\Logger
Gets Logger instance from the registry via static method call
string | $name | Name of the requested Logger instance |
array | $arguments | Arguments passed to static method call |
If named Logger instance is not in the registry
Requested instance of Logger