<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_spewer(self, gconfig, fd):
        '''Child process to manage logging.

        This reads pairs of lines from `fd`, which are alternating
        priority (Python integer) and message (unformatted string).

        '''
        setproctitle('rejester fork_worker log task')
        yakonfig.set_default_config([yakonfig, dblogger], config=gconfig)
        try:
            while True:
                prefix = os.read(fd, struct.calcsize('ii'))
                level, msglen = struct.unpack('ii', prefix)
                msg = os.read(fd, msglen)
                logger.log(level, msg)
        except Exception, e:
            logger.critical('log writer failed', exc_info=e)
            raise