protected function writeLogFileLines(string $event, array $lines): int
    {
        if (!$lines) { // No lines?
            return 0; // Stop; nothing to do here.
        }
        $this->prepareLogsDir(); // Prepares (and secures).

        if (mb_strpos($event, '#') !== false) {
            $file_name = mb_strstr($event, '#');
            $file_name = $this->c::nameToSlug($file_name);
            $file_name .= '.log'; // Add extension now.
        }
        $file_name    = $file_name ?: 'debug.log';
        $process_file = $this->logs_dir.'/process.'.$file_name;
        $file         = $this->logs_dir.'/'.$file_name;

        $this->maybeRotateLogFiles($file);

        $entry = implode("\n", $lines)."\n\n".str_repeat('-', 3)."\n\n";

        if (!isset($this->first_process_writes[$process_file])) {
            $this->first_process_writes[$process_file] = -1;
            @unlink($process_file); // First-process write.
        } // ↑ Empty file on the first write in each process.

        file_put_contents($process_file, $entry, LOCK_EX | FILE_APPEND);
        return (int) file_put_contents($file, $entry, LOCK_EX | FILE_APPEND);
    }