public function log(string $message, string $path = null, array $options = []): void
    {
        $options =
            $options +
            (is_null($path) ? [] : ['path' => $path]) +
            $this->defaults;
        $path = $options['path'];
        if (is_null($path)) {
            throw new \RuntimeException("Missing path");
        }
        $realPath = realpath(dirname($path));
        if (FALSE === $realPath) {
            throw new \RuntimeException(sprintf(
                "Invalid directory '%s'",
                $path
            ));
        }
        $path = sprintf(
            "%s/%s",
            $realPath,
            basename($path)
        );
        clearstatcache(true, $path);
        if (file_exists($path) && (filesize($path) > $options['maxSize'])) {
            for ($i = $options['rotation']; $i > 0; --$i) {
                $destPath = sprintf("%s.%d", $path, $i);
                if (file_exists($destPath)) {
                    unlink($destPath);
                }
                $sourcePath = $i > 1 ? sprintf("%s.%d", $path, $i - 1) : $path;
                if (file_exists($sourcePath)) {
                    rename($sourcePath, $destPath);
                }
            }
            if (file_exists($path)) {
                unlink($path);
            }
        }
        file_put_contents($path, $message, FILE_APPEND);
        if (!is_null($options['rights'])) {
            chmod($path, $options['rights']);
        }
    }