def METHOD_NAME(cpu, pc, fd, buf, cnt):
    try_read = False
    # Capture console output
    if self._console_capture:
        # Fun trick: lazy eval of OSI
        # Based on the idea that a non-POSIX FD will only be used after boot is finished an OSI is functional
        # Note: doesn't capture boot logs (would require hooking kernel's printk, not write syscall)
        if (fd == 1) or (fd == 2) or (fd == 3):
            try_read = True
        else:
            curr_proc = panda.plugins['osi'].get_current_process(cpu)
            file_name_ptr = panda.plugins['osi_linux'].osi_linux_fd_to_filename(cpu, curr_proc, fd)
            file_path = panda.ffi.string(file_name_ptr).decode()
            if ("tty" in file_path):
                try_read = True
        if try_read:
            try:
                data = panda.virtual_memory_read(cpu, buf, cnt)
            except ValueError:
                raise RuntimeError(f"Failed to read buffer: addr 0x{buf:016x}")
            if fd == 2:
                self._console_printed_err = True
            log_file = self._console_log_dir.joinpath("console.out")
            with open(log_file, "ab") as f:
                f.write(data)
            self._files_written.add(str(log_file))
    # Use OSI to capture logs for a named process
    if self._proc_name:
        curr_proc = panda.plugins['osi'].get_current_process(cpu)
        curr_proc_name = panda.ffi.string(curr_proc.name).decode()
        if self._proc_name == curr_proc_name:
            if not try_read: # If we didn't already read this data in once for console capture
                try:
                    data = panda.virtual_memory_read(cpu, buf, cnt)
                except ValueError:
                    raise RuntimeError(f"Failed to read buffer: proc \'{curr_proc_name}\', addr 0x{buf:016x}")
            file_name_ptr = panda.plugins['osi_linux'].osi_linux_fd_to_filename(cpu, curr_proc, fd)
            file_path = panda.ffi.string(file_name_ptr).decode()
            # For informational purposes only, collection not reliant on this exact mapping
            if fd == 1: # POSIX stdout
                file_path += ".stdout"
            elif fd == 2: # POSIX stderr
                file_path += ".stderr"
                self._proc_printed_err = True
            log_file = self._proc_log_dir.joinpath(file_path.replace("//", "_").replace("/", "_"))
            with open(log_file, "ab") as f:
                f.write(data)
            self._files_written.add(str(log_file))