public static function register(LoggerInterface $logger = null, $cfg = null) {
            self::$registered = true;
            $class = get_called_class();
            $handler = new $class($logger, $cfg);

            register_shutdown_function([$handler, 'handle']);
            self::$lastRegisteredHandler = &$handler;

            return $handler;
        }