Persists all of the audit log event objects that are provided

@param array $auditLogs An array of EventInterface objects
@return void
775369
public function logEvents(array $auditLogs)
    {
        foreach ($auditLogs as $log) {
            $eventType = $log->getEventType();
            $primaryKey = $log->getId();
            if (is_array($primaryKey)) {
                if (count($primaryKey) == 1) {
                    $primaryKey = array_pop($primaryKey);
                } else {
                    $primaryKey = json_encode($primaryKey);
                }
            }
            $date = new DateTime($log->getTimestamp());
            $meta = (array)$log->getMetaInfo();
            $data = [
                'created' => $date,
                'transaction' => $log->getTransactionId(),
                'type' => $eventType,
                'source_key' => $primaryKey,
                'source' => $log->getSourceName(),
                'parent_source' => $log->getParentSourceName(),
                'original' => $eventType === 'delete' ? null : json_encode($log->getOriginal()),
                'changed' => $eventType === 'delete' ? null : json_encode($log->getChanged()),
                'meta' => json_encode($meta)
            ];
            $Audit = $this->loadModel('Audits');
            if (!empty($meta['user'])) {
                $data['user_id'] = $meta['user'];
            }
            $record = $Audit->newEntity($data);
            $Audit->save($record);
        }
    }
369679
protected function registerServerEvents(array $events): void
    {
        $eventInfo = [];

        // register event to swoole
        foreach ($events as $name => $cb) {
            // is a Closure callback, add by self::onSwoole()
            if (\is_object($cb) && \method_exists($cb, '__invoke')) {
                $eventInfo[] = [$name, \get_class($cb)];
                $this->server->on($name, $cb);
                continue;
            }

            if (\is_string($cb)) {
                if (\is_int($name)) {
                    $name = $cb;
                }

                $method = SwooleEvent::getHandler($cb);
                if ($method && \method_exists($this, $method)) {
                    $eventInfo[] = [$name, static::class . "->$method"];
                    $this->server->on($name, [$this, $method]);
                } elseif (\function_exists($cb)) {
                    $eventInfo[] = [$name, $cb];
                    $this->server->on($name, $cb);
                }
            }
        }

        Show::table($eventInfo, 'Registered events to the server', [
            'showBorder' => 0,
            'columns'    => ['event name', 'swoole event handler']
        ]);
    }
226189
public function log(\Imi\Log\Record $record)
    {
        if(in_array($record->getLevel(), $this->levels))
        {
            $this->records[] = $record;
            $this->trySave();
        }
    }
930674
public function setReports($reports)
    {
        $this->_reports = array();
        $token          = ' ,;';
        $report         = strtok($reports, $token);

        while ($report !== false) {
            $this->_reports[] = $reports;
            $report           = strtok($token);
        }

    }
520014
public function prepareAudit()
    {
        if (!isset($this->auditEnabled) || $this->auditEnabled) {
            $this->originalData = $this->original;
            $this->updatedData  = $this->attributes;

            foreach ($this->updatedData as $key => $val) {
                if (gettype($val) == 'object' && !method_exists($val, '__toString')) {
                    unset($this->originalData[$key]);
                    unset($this->updatedData[$key]);
                    array_push($this->dontKeep, $key);
                }
            }

            // Dont keep log of
            $this->dontKeep = isset($this->dontKeepLogOf) ?
                    $this->dontKeepLogOf + $this->dontKeep : $this->dontKeep;

            // Keep log of
            $this->doKeep = isset($this->keepLogOf) ?
                    $this->keepLogOf + $this->doKeep : $this->doKeep;

            unset($this->attributes['dontKeepLogOf']);
            unset($this->attributes['keepLogOf']);


            // Get changed data
            $this->dirtyData = $this->getDirty();
            // Tells whether the record exists in the database
            $this->updating  = $this->exists;
        }
    }
742365
public function log(array $log)
    {
        if (null !== $this->config->getLoggerCallable()) {
            call_user_func($this->config->getLoggerCallable(), $log);
        }
    }
736072
public static function info(...$messages): void
    {
        static::init();

        if (!static::isTemporaryDisabled('info')) {
            foreach (static::$adapters as $adapter) {
                /* @var $adapter \Koldy\Log\Adapter\AbstractLogAdapter */
                if ($adapter->isLevelEnabled(self::INFO)) {
                    $adapter->info((new Message(self::INFO))->setMessages($messages));
                }
            }
        }
    }
347595
private void replayLogs(Collection<TransactionLog> logs) {
    for (TransactionLog log : logs) {
      LOG.info("Replaying edits from transaction log " + log.getName());
      int editCnt = 0;
      try {
        TransactionLogReader reader = log.getReader();
        // reader may be null in the case of an empty file
        if (reader == null) {
          continue;
        }
        TransactionEdit edit = null;
        while ((edit = reader.next()) != null) {
          editCnt++;
          switch (edit.getState()) {
            case INPROGRESS:
              long expiration = edit.getExpiration();
              TransactionType type = edit.getType();
              // Check if transaction needs to be migrated to have expiration and type. Previous version of 
              // long running transactions were represented with expiration time as -1.
              // This can be removed when we stop supporting TransactionEditCodecV2.
              if (expiration < 0) {
                expiration = getTxExpirationFromWritePointer(edit.getWritePointer(), defaultLongTimeout);
                type = TransactionType.LONG;
              } else if (type == null) {
                type = TransactionType.SHORT;
              }
              addInProgressAndAdvance(edit.getWritePointer(), edit.getVisibilityUpperBound(),
                                      expiration, type);
              break;
            case COMMITTING:
              addCommittingChangeSet(edit.getWritePointer(), edit.getChanges());
              break;
            case COMMITTED:
              // TODO: need to reconcile usage of transaction id v/s write pointer TEPHRA-140
              long transactionId = edit.getWritePointer();
              long[] checkpointPointers = edit.getCheckpointPointers();
              long writePointer = checkpointPointers == null || checkpointPointers.length == 0 ?
                transactionId : checkpointPointers[checkpointPointers.length - 1];
              doCommit(transactionId, writePointer, edit.getChanges(),
                       edit.getCommitPointer(), edit.getCanCommit());
              break;
            case INVALID:
              doInvalidate(edit.getWritePointer());
              break;
            case ABORTED:
              type = edit.getType();
              // Check if transaction edit needs to be migrated to have type. Previous versions of
              // ABORTED edits did not contain type.
              // This can be removed when we stop supporting TransactionEditCodecV2.
              if (type == null) {
                InProgressTx inProgressTx = inProgress.get(edit.getWritePointer());
                if (inProgressTx != null) {
                  type = inProgressTx.getType();
                } else {
                  // If transaction is not in-progress, then it has either been already aborted or invalidated.
                  // We cannot determine the transaction's state based on current information, to be safe invalidate it.
                  LOG.warn("Invalidating transaction {} as it's type cannot be determined during replay",
                           edit.getWritePointer());
                  doInvalidate(edit.getWritePointer());
                  break;
                }
              }
              doAbort(edit.getWritePointer(), edit.getCheckpointPointers(), type);
              break;
            case TRUNCATE_INVALID_TX:
              if (edit.getTruncateInvalidTxTime() != 0) {
                doTruncateInvalidTxBefore(edit.getTruncateInvalidTxTime());
              } else {
                doTruncateInvalidTx(edit.getTruncateInvalidTx());
              }
              break;
            case CHECKPOINT:
              doCheckpoint(edit.getWritePointer(), edit.getParentWritePointer());
              break;
            default:
              // unknown type!
              throw new IllegalArgumentException("Invalid state for WAL entry: " + edit.getState());
          }
        }
      } catch (IOException ioe) {
        throw Throwables.propagate(ioe);
      } catch (InvalidTruncateTimeException e) {
        throw Throwables.propagate(e);
      }
      LOG.info("Read " + editCnt + " edits from log " + log.getName());
    }
  }
251652
public static function sql(...$messages): void
    {
        static::init();

        if (!static::isTemporaryDisabled('sql')) {
            foreach (static::$adapters as $adapter) {
                /* @var $adapter \Koldy\Log\Adapter\AbstractLogAdapter */
                if ($adapter->isLevelEnabled(self::SQL)) {
                    $adapter->sql((new Message(self::SQL))->setMessages($messages));
                }
            }
        }
    }
719313
public function record(EventMessage $message): void
    {
        $eventRecord = new EventRecord(
            $message,
            $this->aggregateId,
            $this->aggregateType,
            $this->nextSequence()
        );
        $this->lastSequence = $eventRecord->sequenceNumber();
        $this->eventRecords->add($eventRecord);
    }
669044
public function log(array $log)
    {
        if (null !== $this->config->getLoggerCallable()) {
            call_user_func_array($this->config->getLoggerCallable(), array($log));
        }
    }
107472
protected function getContextArray(AuditLog $event)
    {
        $accessor = PropertyAccess::createPropertyAccessor();

        $refObject = new \ReflectionObject($event);

        $arr = array();

        foreach ($this->getAllProperties($refObject) as $property) {
            if (!$accessor->isReadable($event, $property->getName()) || in_array($property->getName(), self::$ignoreProperties)) {
                continue;
            }

            $arr[$property->getName()] = $accessor->getValue($event, $property->getName());
        }

        return $arr;
    }
881550
public function log($messages)
    {
        if (!is_array($messages)) {
            $messages = [$messages];
        }
        foreach ($messages as $message) {
            file_put_contents($this->logFile, date('d.m.Y H:i:s') . ' - ' . $message . PHP_EOL, FILE_APPEND | LOCK_EX);
        }
    }
539204
@Override
    public void audit(final LoggingEvent e) {
        try {
            logger.info(MarkerFactory.getMarker(AUDIT), serialize(e));
        } catch (Exception ex) {
            throw new RuntimeException("unable to serialize event", ex);
        }
    }
806584
public static function notice(...$messages): void
    {
        static::init();

        if (!static::isTemporaryDisabled('notice')) {
            foreach (static::$adapters as $adapter) {
                /* @var $adapter \Koldy\Log\Adapter\AbstractLogAdapter */
                if ($adapter->isLevelEnabled(self::NOTICE)) {
                    $adapter->notice((new Message(self::NOTICE))->setMessages($messages));
                }
            }
        }
    }
1210081
private function logValueToTable(array $logs)
    {
        $table = new Table();
        $table->setHeaders(['Key', 'Value']);
        $rows = [];
     
        foreach ($logs as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $kk => $kv) {
                    $rows[] = [$kk, $kv];
                }
            } else {
                $rows[] = [$key, $value];
            }
        }
        $table->setRows($rows);
        echo $table->run();
    }
805789
protected function __save()
    {
        foreach($this->records as $record)
        {
            $content = $this->getLogString($record);
            if($this->length > 0)
            {
                $content = mb_substr($content, 0, $this->length) . '...';
            }
            echo $content, PHP_EOL;
        }
    }