Add a log

@param string $message
@param array  $context
@param int    $level
@param string $role
@param int    $times
@param int    $ttl
@param bool   $defer
333794
public function record(
        $message = '',
        $context = [],
        $level = Logger::NOTICE,
        $role = 'system',
        $times = 0,
        $ttl = 0,
        $defer = false
    ) {
        if (isset($this->loggers[$role])) {
            if ($times > 0 && $ttl > 0) {
                $cacheKey = md5($message);
                $cnt = RedisKit::incr($cacheKey);
                if ($cnt == 1) {
                    RedisKit::expire($cacheKey, $ttl);
                }
                if ($cnt > $times) {
                    return;
                }
            }

            if ($defer) {
                $this->addDeferLog($role, $level, $message, $context);
                if ($this->deferLogsCount >= self::MAX_DEFER_LOGS) {
                    $this->flush();
                }
                return;
            }

            $this->loggers[$role]->addRecord($level, $message, $context);
            Lb::app()->trigger(
                self::LOG_WRITE_EVENT, new LogWriteEvent(
                    [
                    'level' => $level,
                    'message' => $message,
                    'context' => $context,
                    'role' => $role,
                    'time' => time(),
                    ]
                )
            );
        }
    }
21184
public function log($level, $message, array $context = array()) {
		foreach($this->keyValueArray as $key => $value) {
			if(is_object($value)) {
				if(method_exists($value, '__toString')) {
					$value = (string)$value;
				} else {
					$value = json_encode($value);
				}
			}
			$context[$key] = $value;
		}
		$this->logger()->log($level, $message, $context);
	}
1370632
public function log($level, $message, array $context = array())
    {
        $this->logMessage(
            $level,
            $this->getFormattedMessage($level, $message)
        );
    }
1360679
public function log($message, $level = LogLevel::INFO, $context = array())
    {
        // Skip if no logger has been loaded.
        if (!$this->logger) {
            return;
        }

        if (!is_array($message)) {
            $message = array($message);
        }

        // The build is added to the context so the logger can use
        // details from it if required.
        $context['build'] = $this->build;

        foreach ($message as $item) {
            $this->logger->log($level, $item, $context);
        }
    }
947455
public static function log($level, $message, array $context = array())
    {
        App::getBean('Logger')->log($level, $message, static::parseContext($context));
    }
903001
public function log($level, $message, array $context = [])
    {
        // convert level to syslog level
        $syslogPriority = self::levelToPriority($level);

        syslog(
            $syslogPriority,
            $message
        );
    }
166006
public function log($level, $message, array $context = array())
    {
        foreach ($this->loggerInstances as $logger) {
            $logger->log($level, $message, $context);
        }
    }
129875
public function log($message, array $context = array(), $level = Logger::INFO)
    {
        return $this['monolog']->addRecord($level, $message, $context);
    }
1184837
public function log($level, $message, array $context = array())
    {
        if ($this->level > $level || array_key_exists($level, $this->levels) === false) {
            return;
        }

        $this->out($this->levels[$level], $message, $context);
    }
618674
public function log($level, $message, array $context = []) {
        $levelPriority = self::levelPriority($level);
        if ($levelPriority > LOG_DEBUG) {
            throw new \Psr\Log\InvalidArgumentException("Invalid log level: $level.");
        }

        // Prevent an infinite cycle by setting an internal flag.
        static $inCall = false;
        if ($inCall) {
            return;
        }
        $inCall = true;

        foreach ($this->loggers as $logger) {
            /* @var LoggerInterface $logger */
            if (!$logger['enabled']) {
                continue;
            }

            if ($logger['priority'] >= $levelPriority) {
                try {
                    $logger['logger']->log($level, $message, $context);
                } catch (\Exception $ex) {
                    $inCall = false;
                    throw $ex;
                }
            }
        }

        $inCall = false;
    }
1095414
public function log($level, $message, array $context = array())
    {
        $this->getClient()->notify(
            $message,
            array_merge(['level' => $this->levelMapping[$level]], $this->getExtractor()->extract($context))
        );
    }
600082
public function log($level, $message, array $context = array()) {
		if($this->maxLength < mb_strlen($message, $this->charset)) {
			$ellipses = iconv('UTF-8', $this->charset, $this->ellipsis);
			$message = mb_substr($message, 0, $this->maxLength - strlen($this->ellipsis), $this->charset);
			$message = $message . $ellipses;
		}
		$this->logger()->log($level, $message, $context);
	}
35856
public function log($level, $message, array $context = []): void {
        if ($this->logger instanceof LoggerInterface) {
            $message = $this->interpolate($message, $context);
            $this->logger->log($level, $message, $context);
        }
    }
449277
public function log($level, $message, array $context = array()) {
		$result = preg_match(sprintf("/%s/%s", preg_quote($this->pattern, '/'), $this->modifiers), $message);
		if(!$result !== $this->negate) {
			$this->logger()->log($level, $message, $context);
		}
	}
440737
public static function log($level, $message, array $context = [], array $params = [])
    {
        self::init($params);
        self::$instance->log($level, $message, $context);
    }
979632
public function log($level, $message, array $context = [])
    {
        if (!$this->enabled) {
            return;
        }
        $message = self::replace($message, $context);
        if (is_resource($this->resource)) {
            fwrite($this->resource, "[{$level}] " . $message. "\n");
        } elseif (is_callable($this->resource)) {
            call_user_func($this->resource, "[{$level}] {$message}\n");
        } else {
            echo "[{$level}] {$message}\n";
        }
    }
1359484
public function log($level, $message, array $context = array())
    {
        $this->dispatcher->dispatch(Log::EVENT_NAME, new Log($level, $message, $context, []));
    }