original_string: public function log($type, $data, $severity = 'info', $translatable = true)
      {
          $message = '';
  
          if (is_string($data)) {
              $message = $data;
          } elseif (isset($data['message'])) {
              $message = (string) $data['message'];
          }
  
          $values = array(
              'text' => $message,
              'data' => (array) $data,
              'translatable' => $translatable,
              'type' => mb_substr($type, 0, 255),
              'severity' => mb_substr($severity, 0, 255)
          );
  
          return $this->add($values);
      }
code: public function log($type, $data, $severity = 'info', $translatable = true)
      {
          $message = '';
  
          if (is_string($data)) {
              $message = $data;
          } elseif (isset($data['message'])) {
              $message = (string) $data['message'];
          }
  
          $values = array(
              'text' => $message,
              'data' => (array) $data,
              'translatable' => $translatable,
              'type' => mb_substr($type, 0, 255),
              'severity' => mb_substr($severity, 0, 255)
          );
  
          return $this->add($values);
      }
code_tokens: public function log ( $ type , $ data , $ severity = 'info' , $ translatable = true ) { $ message = '' ; if ( is_string ( $ data ) ) { $ message = $ data ; } elseif ( isset ( $ data [ 'message' ] ) ) { $ message = ( string ) $ data [ 'message' ] ; } $ values = array ( 'text' => $ message , 'data' => ( array ) $ data , 'translatable' => $ translatable , 'type' => mb_substr ( $ type , 0 , 255 ) , 'severity' => mb_substr ( $ severity , 0 , 255 ) ) ; return $ this -> add ( $ values ) ; }
docstring: Writes a log message to the database
  @param string $type
  @param array|string $data
  @param string $severity
  @param boolean $translatable
  @return boolean
docstring_tokens: Writes a log message to the database