<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def log(self, level, message):
        '''Write a log message via the child process.

        The child process must already exist; call :meth:`live_log_child`
        to make sure.  If it has died in a way we don't expect then
        this will raise :const:`signal.SIGPIPE`.

        '''
        if self.log_fd is not None:
            prefix = struct.pack('ii', level, len(message))
            os.write(self.log_fd, prefix)
            os.write(self.log_fd, message)