<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_message(self, user, message):
 """Log a channel message. This log acts as a sort of cache so that recent activity can be searched by the bot and command modules without querying the database. """

        
        if isinstance(user, SeshetUser):
            user = user.nick
        elif not isinstance(user, IRCstr):
            user = IRCstr(user)

        time = datetime.utcnow()
            
        self.message_log.append((time, user, message))
        
        while len(self.message_log) > self._log_size:
            del self.message_log[0]