public static function make(array $config = [], $name = '')
    {
        if (!\is_array($config)) {
            throw new \InvalidArgumentException('Logger config is must be an array and not allow empty.');
        }

        $name = $name ?: ($config['name'] ?? '');

        if (!$name) {
            throw new \InvalidArgumentException('Logger name is required.');
        }

        if (!isset(self::$loggers[$name])) {
            self::$loggers[$name] = new static($config, $name);
        }

        // register shutdown function
        if (!self::$shutdownRegistered) {
            register_shutdown_function(function () {
                // make regular flush before other shutdown functions, which allows session data collection and so on
                self::flushAll();

                // make sure log entries written by shutdown functions are also flushed
                // ensure "flush()" is called last when there are multiple shutdown functions
                register_shutdown_function([self::class, 'flushAll'], true);
            });

            self::$shutdownRegistered = true;
        }

        return self::$loggers[$name];
    }