本文整理汇总了PHP中Illuminate\Log\Writer::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::warning方法的具体用法?PHP Writer::warning怎么用?PHP Writer::warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Log\Writer
的用法示例。
在下文中一共展示了Writer::warning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
/**
* @param string $listId
* @param string $emailAddress
* @param array $mergeFields
* @param bool|false $confirm
* @return bool
*/
public function subscribe(string $listId, string $emailAddress, array $mergeFields = [], bool $confirm = false)
{
// Check the list exists
if (!$this->checkListExists($listId)) {
if ($this->error) {
return false;
// callApi() error
}
return $this->errorResponse('Subscribe called on list that does not exist: ' . $listId);
}
// Check address is valid for subscription
$status = $this->checkStatus($listId, $emailAddress);
if (in_array($status, ['subscribed', 'pending', 'cleaned'])) {
$this->logger->warning("Attempt to subscribe {$emailAddress} to list#{$listId}, already on the list and marked {$status} - no action taken");
return true;
}
// Add/update the subscriber - PUT does both
$id = md5(strtolower($emailAddress));
$endpoint = "lists/{$listId}/members/{$id}";
$status = $confirm ? 'pending' : 'subscribed';
$data = ['email_address' => $emailAddress, 'status' => $status];
if (!empty($mergeFields)) {
$data['merge_fields'] = $mergeFields;
}
$response = $this->callApi('put', $endpoint, $data);
if (!$response) {
return false;
}
if (empty($response['status']) || !in_array($response['status'], ['subscribed', 'pending'])) {
return $this->errorResponse('Subscribe received unexpected response:' . json_encode($response));
}
return true;
}
示例2: loger
function loger($level, $file, $line, $string, $ar = NULL)
{
// если системный level ниже notice, то при включеном KINT_DUMP, ставим уровень notice
if ($GLOBALS['KINT_DUMP'] && $this->agiconfig['verbosity_level'] < 2) {
$this->agiconfig['verbosity_level'] = 2;
}
if ($this->agiconfig['verbosity_level'] < $level) {
return;
}
if ($GLOBALS['KINT_DUMP']) {
~d("{$level} | {$file} | {$line}");
if (!is_null($string)) {
d($string);
}
if (!is_null($ar)) {
d($ar);
}
return;
}
if (!is_null($string)) {
$this->agi->verbose($string);
}
if (!is_null($ar)) {
$this->agi->verbose($ar);
}
if ((int) $this->agiconfig['logging_write_file'] === 1) {
$logger = new Writer(new Logger('local'));
$logger->useFiles($this->config['logs_patch']);
if (!is_null($ar)) {
$string .= "\n";
$string .= var_export($string, true);
}
switch ($level) {
case 'error':
$logger->error("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
break;
case 'warning':
$logger->warning("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
break;
case 'notice':
$logger->notice("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
break;
case 'info':
$logger->info("[" . $this->uniqueid . "] [{$file}] [{$line}]: {$string}");
break;
default:
$logger->debug("[" . $this->uniqueid . "] [{$file}] [{$line}]: {$string}");
break;
}
}
}