/**
* Register a logger
*
* @param string $key The service key to be registered
* @param string $class The class name of the logger
* @param boolean $replace Flag indicating the service key may replace an existing definition
*
* @return void
*
* @since 4.0.0
*/
public function register(string $key, string $class, bool $replace = false)
{
// If the key exists already and we aren't instructed to replace existing services, bail early
if (isset($this->loggerMap[$key]) && !$replace) {
throw new \RuntimeException("The '{$key}' key is already registered.");
}
// The class must exist
if (!class_exists($class)) {
throw new \RuntimeException("The '{$class}' class for key '{$key}' does not exist.");
}
$this->loggerMap[$key] = $class;
}