code: def save_admin_log(build, **kwargs):
      
      message = kwargs.pop('message', None)
      release = kwargs.pop('release', None)
      run = kwargs.pop('run', None)
  
      if not len(kwargs) == 1:
          raise TypeError('Must specify a LOG_TYPE argument')
  
      log_enum = kwargs.keys()[0]
      log_type = getattr(models.AdminLog, log_enum.upper(), None)
      if not log_type:
          raise TypeError('Bad log_type argument: %s' % log_enum)
  
      if current_user.is_anonymous():
          user_id = None
      else:
          user_id = current_user.get_id()
  
      log = models.AdminLog(
          build_id=build.id,
          log_type=log_type,
          message=message,
          user_id=user_id)
  
      if release:
          log.release_id = release.id
  
      if run:
          log.run_id = run.id
          log.release_id = run.release_id
  
      db.session.add(log)
docs: Saves an action to the admin log.