function log($text, $who, $pids = null)
 {
     if (!$who) {
         $who = 0;
     } else {
         if (!is_numeric($who)) {
             if ($who->email && !$who->contactId) {
                 $text .= " <{$who->email}>";
             }
             $who = $who->contactId;
         }
     }
     if (is_object($pids)) {
         $pids = array($pids->paperId);
     } else {
         if (!is_array($pids)) {
             $pids = $pids > 0 ? array($pids) : array();
         }
     }
     $ps = array();
     foreach ($pids as $p) {
         $ps[] = is_object($p) ? $p->paperId : $p;
     }
     if ($this->_save_logs === false) {
         Dbl::q_raw(self::format_log_query($text, $who, $ps));
     } else {
         $key = "{$who}|{$text}";
         if (!isset($this->_save_logs[$key])) {
             $this->_save_logs[$key] = [];
         }
         foreach ($ps as $p) {
             $this->_save_logs[$key][$p] = true;
         }
     }
 }