@param LogDataInterface $log

@return bool
760941
public function update( LogDataInterface $log ) {

		if ( ! did_action( Controller::ACTION_LOADED ) || $log->level() < 1 ) {
			return FALSE;
		}

		try {

			return $this->channels
				->logger( $log->channel() )
				->addRecord( $log->level(), $log->message(), $log->context() );

		} catch ( \Throwable $e ) {
			/**
			 * Fires when the logger encounters an error.
			 *
			 * @param LogDataInterface      $log
			 * @param \Exception|\Throwable $e
			 */
			do_action( self::ACTION_LOGGER_ERROR, $log, $e );

			return FALSE;
		} catch ( \Exception $e ) {
			/** This action is documented in src/LogActionSubscriber.php */
			do_action( self::ACTION_LOGGER_ERROR, $log, $e );

			return FALSE;
		}
	}
573273
public function canReport(Throwable $e): bool
    {
        $level = $this->getLogLevel($e);

        // TODO : utiliser la méthode shouldLog():bool
        return $this->logLevels[$level] <= $this->logLevels[$this->logLevelThreshold];
    }
338458
protected function resolveJsonCastableColumns(&$log)
    {
        foreach ($log as $name => $value) {
            if (!is_array($value)) {
                continue;
            }
            $log[$name] = json_encode($value);
        }
        return $log;
    }
472129
protected function allowedToUseFormFieldData(ModelFormFieldDataInterface $field)
    {
        if ( ! $field->adminOnly() && ! count($field->permissions())) {
            return true;
        }

        $user = $this->getCore()->auth()->user();

        if ( ! $user || $field->adminOnly() && ! $user->isAdmin()) {
            return false;
        }

        if ($user->isAdmin() || ! count($field->permissions())) {
            return true;
        }

        return $user->can($field->permissions());
    }
363618
public function prune($log = null)
    {
        if ($log) {
            $this->addUsingAlias(LogTableMap::COL_ID, $log->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
910133
public function validLoggedInAdmin()
    {
        $loggedInUser = $this->getCurrentLoggedInUser();
        if ($loggedInUser
            && $loggedInUser->administrator
            && $loggedInUser->deleted === null
            && $loggedInUser->enabled) {
                return true;
        }
        return false;
    }
594356
protected function _reportDiff($log)
    {
        $data = $log->data();

        $this->write("It expect actual ");

        if ($log->not()) {
            $this->write('NOT ', 'cyan');
            $not = 'not ';
        } else {
            $not = '';
        }
        $this->write("to {$log->description()}\n\n");

        foreach ($data as $key => $value) {
            if (preg_match('~actual~', $key)) {
                $this->write("{$key}:\n", 'yellow');
                $this->prefix($this->format(' ', 'n;;91') . ' ');
            } elseif (preg_match('~expected~', $key)) {
                $this->write("{$not}{$key}:\n", 'yellow');
                $this->prefix($this->format(' ', 'n;;92') . ' ');
            } else {
                $this->write("{$key}:\n", 'yellow');
            }
            $type = gettype($value);
            $toString = function ($instance) {
                return 'an instance of `' . get_class($instance) . '`';
            };
            $this->write("({$type}) " . Text::toString($value, ['object' => ['method' => $toString]]));
            $this->prefix('');
            $this->write("\n");
        }
        $this->write("\n");
    }
1313353
public function addLog(Log $log)
    {
        $log->setInstance($this);
        $this->getLogs()->add($log);
    }
138575
public static function log( $log ) {
	
		if ( ! self::is_debug() ) {
			return;
		}

		if ( is_bool( $log ) ) {
			$log = $log ? 'true' : 'false';
		}

		/**
		 * __FILE__
		 * __LINE__
		 * https://stackoverflow.com/questions/1252529/get-code-line-and-file-thats-executing-the-current-function-in-php
		 */
		$bt = debug_backtrace();
		$caller = array_shift( $bt );

		error_log( print_r( $caller['file'] . ' Line: ' . $caller['line'], true ) );
		error_log( print_r( $log, true ) );

		// if ( is_array( $log ) || is_object( $log ) ) {
		//  error_log( print_r( $log, true ) );
		// } else {
		//  error_log( $log );
		// }

	}
610479
public function mapLogLevel(ErrorInterface $error)
    {

        // initialize the log level, default is 'error'
        $logLevel = LogLevel::ERROR;

        // query the error type
        switch ($error->getType()) {
            case E_WARNING:
            case E_USER_WARNING:
            case E_COMPILE_WARNING:
            case E_RECOVERABLE_ERROR:
                $logLevel = LogLevel::WARNING;
                break;

            case E_NOTICE:
            case E_USER_NOTICE:
            case E_STRICT:
            case E_DEPRECATED:
            case E_USER_DEPRECATED:
                $logLevel = LogLevel::NOTICE;
                break;

            default:
                break;
        }

        // return the log level
        return $logLevel;
    }
557003
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        switch ($type->getDataType()) {
            case Types::T_NUMBER:
            case Types::T_RESOURCE:
            case Types::T_VARIABLE:
            case Types::T_CALLABLE:
            case Types::T_ITERABLE:
                return true;
            default:
                return false;
        }
    }
32297
protected function parseLog($log)
    {
        preg_match_all(LogParser::getMatchString(), $log, $matches);
        $metaData = [];
        $numEntries = count($matches[1]);
        for ($i = 0; $i < $numEntries; $i++) {
            $hash = $matches[1][$i];
            $name = $matches[2][$i];
            $eMail = $matches[3][$i];
            $timeStamp = (int)$matches[4][$i];
            $message = $matches[5][$i];
            $metaData[] = new CommitMetadata($hash, $name, $eMail, $timeStamp, $message);
        }

        return $metaData;
    }
447939
private function validateLogLevel(PsrLoggerConfigurationInterface $configuration)
    {
        $logLevel = $configuration->getLogLevel();

        if (!in_array($logLevel, $this->validLogLevels, true)) {
            throw new \InvalidArgumentException(
                'Log level "' . var_export($logLevel, true) . '" is not a PSR-3 compliant log level'
            );
        }
    }
960268
public boolean logModified(Logger log)
  {
    if (_isDigestModified) {
      log.info(_source.getNativePath() + " digest is modified.");

      return true;
    }

    long sourceLastModified = _source.getLastModified();
    long sourceLength = _source.length();

    // if the source was deleted and we need the source
    if (! _requireSource && sourceLastModified == 0) {
      return false;
    }
    // if the length changed
    else if (sourceLength != _length) {
      log.info(_source.getNativePath() + " length is modified (" +
               _length + " -> " + sourceLength + ")");

      return true;
    }
    // if the source is newer than the old value
    else if (sourceLastModified != _lastModified) {
      log.info(_source.getNativePath() + " time is modified.");
      
      return true;
    }
    else
      return false;
  }
460679
private function handleMessage(HandlerInterface $handler, MessageInterface $message): bool
    {
        // check if handler implements Psr\Log\LoggerAwareInterface (you can use \Psr\Log\LoggerAwareTrait)
        if ($this->logger && method_exists($handler, 'setLogger')) {
            $handler->setLogger($this->logger);
        }

        try {
            $result = $handler->handle($message);

            $this->log(
                LogLevel::INFO,
                "End handle message #{$message->getId()} ({$message->getType()})",
                $this->messageLoggerContext($message)
            );
        } catch (Exception $e) {
            $this->log(
                LogLevel::ERROR,
                "Handler " . get_class($handler) . " throws exception - {$e->getMessage()}",
                ['error' => $e, 'message' => $this->messageLoggerContext($message), 'exception' => $e]
            );
            Debugger::log($e, Debugger::EXCEPTION);
            $result = false;
        }
        return $result;
    }
467227
public function isARepeat(LogGenericEvent $event)
    {
        if ($this->tokenStorage->getToken() === null) {
            //Only if have a user session;
            return false;
        }

        if ($event instanceof LogNotRepeatableInterface) {
            $request = $this->container->get('request');
            $session = $request->getSession();

            $is = false;
            $pushInSession = true;
            $now = time();

            //if ($session->get($event->getAction()) != null) {
            if ($session->get($event->getLogSignature()) != null) {
                //$oldArray = json_decode($session->get($event->getAction()));
                $oldArray = json_decode($session->get($event->getLogSignature()));
                $oldSignature = $oldArray->logSignature;
                $oldTime = $oldArray->time;

                if ($oldSignature == $event->getLogSignature()) {
                    $diff = ($now - $oldTime);
                    $notRepeatableLogTimeInSeconds = $this->container->getParameter(
                        'non_repeatable_log_time_in_seconds'
                    );

                    if ($event->getIsWorkspaceEnterEvent()) {
                        $notRepeatableLogTimeInSeconds = $notRepeatableLogTimeInSeconds * 3;
                    }

                    if ($diff > $notRepeatableLogTimeInSeconds) {
                        $is = false;
                    } else {
                        $is = true;
                        $pushInSession = false;
                    }
                }
            }

            if ($pushInSession) {
                //Update last logSignature for this event category
                $array = array('logSignature' => $event->getLogSignature(), 'time' => $now);
                //$session->set($event->getAction(), json_encode($array));
                $session->set($event->getLogSignature(), json_encode($array));
            }

            return $is;
        } else {
            return false;
        }
    }
1143124
public function parseLog($log)
    {
        $commits = $tags = [];

        for ($i = 0, $lines = count($log); $i < $lines; $i++) {
            $tmp = explode(': ', $log[$i]);
            $tmp = array_map('trim', $tmp);

            if ($tmp[0] == 'changeset') {
                $commit = $tmp[1];
            }

            if ($tmp[0] == 'user') {
                $email  = $this->extractEmail($tmp[1]);
                $author = $this->extractAuthor($tmp[1]);
            }

            if ($tmp[0] == 'date') {
                $date = trim($tmp[1]);
            }

            if ($tmp[0] == 'tag') {
                $tags[] = trim($tmp[1]);
            }

            if ($tmp[0] == 'summary') {
                $commits[] = [
                    'commit'  => trim($commit),
                    'author'  => trim($author),
                    'email'   => trim($email),
                    'date'    => DateTime::createFromFormat('D M j H:i:s Y O', $date),
                    'summary' => trim($tmp[1]),
                    'tags'    => $tags,
                    'vcs'     => trim($this->repository_type),
                ];
                $tags = [];
            }
        }

        return $commits;
    }