本文整理汇总了PHP中Log::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::notice方法的具体用法?PHP Log::notice怎么用?PHP Log::notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::notice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValidImageFile
/**
* GIF/JPEG/PNG のみ対象
* @param String $filepath
* @return bool
*/
function isValidImageFile($filepath)
{
try {
// WARNING, NOTICE が発生する可能性有り
$img_info = getimagesize($filepath);
switch ($img_info[2]) {
case IMAGETYPE_GIF:
case IMAGETYPE_JPEG:
case IMAGETYPE_PNG:
// getimagesize関数はマジックバイトを見ているだけ
// イメージリソースが生成できるかどうかでファイルの中身を判定する。
// データに問題がある場合、WARNING が発生する可能性有り
if (imagecreatefromstring(file_get_contents($filepath)) !== false) {
return true;
}
}
} catch (\ErrorException $e) {
$err_msg = sprintf("%s(%d): %s (%d) filepath = %s", __METHOD__, $e->getLine(), $e->getMessage(), $e->getCode(), $filepath);
switch ($e->getSeverity()) {
case E_WARNING:
\Log::warning($err_msg);
break;
case E_NOTICE:
\Log::notice($err_msg);
break;
default:
\Log::error($err_msg);
}
}
return false;
}
示例2: LogAction
public function LogAction()
{
Log::fatal('something');
Log::warn('something');
Log::notice('something');
Log::debug('something');
Log::sql('something');
echo '请到Log文件夹查看效果。如果是SAE环境,可以在日志中心的DEBUG日志查看。';
}
示例3: createMedium
function createMedium($url, $filename, $width, $height)
{
# Function creates a smaller version of a photo when its size is bigger than a preset size
# Excepts the following:
# (string) $url = Path to the photo-file
# (string) $filename = Name of the photo-file
# (int) $width = Width of the photo
# (int) $height = Height of the photo
# Returns the following
# (boolean) true = Success
# (boolean) false = Failure
# Set to true when creation of medium-photo failed
global $settings;
$error = false;
# Size of the medium-photo
# When changing these values,
# also change the size detection in the front-end
global $newWidth;
global $newHeight;
# Check permissions
if (hasPermissions(LYCHEE_UPLOADS_MEDIUM) === false) {
# Permissions are missing
$error = true;
echo 'Not enough persmission on the medium folder' . "\n";
}
# Is photo big enough?
# Is Imagick installed and activated?
if ($error === false && ($width > $newWidth || $height > $newHeight) && (extension_loaded('imagick') && $settings['imagick'] === '1')) {
$newUrl = LYCHEE_UPLOADS_MEDIUM . $filename;
# Read image
$medium = new Imagick();
$medium->readImage(LYCHEE . $url);
# Adjust image
$medium->scaleImage($newWidth, $newHeight, true);
# Save image
try {
$medium->writeImage($newUrl);
} catch (ImagickException $err) {
Log::notice($database, __METHOD__, __LINE__, 'Could not save medium-photo: ' . $err->getMessage());
$error = true;
echo 'Imagick Exception:' . "\n";
var_dump($e);
}
$medium->clear();
$medium->destroy();
} else {
# Photo too small or
# Imagick not installed
$error = true;
}
if ($error === true) {
return false;
}
return true;
}
示例4: discard
public function discard($days)
{
$discardedEventCount = ProcessorEventMatchstate::discardOld($this->tDbh, $days);
Log::notice(sprintf("%u old event(s) discarded", $discardedEventCount));
QueryLoghost::discardUnused($this->tDbh);
QueryUser::discardUnused($this->tDbh);
QueryHostipNetwork::discardUnused($this->tDbh);
QueryHostip::discardUnused($this->tDbh);
QueryHostmac::discardUnused($this->tDbh);
QueryService::discardUnused($this->tDbh);
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param StoreBoardsRequest|Request $request
* @return \Illuminate\Http\Response
*/
public function store(StoreBoardsRequest $request)
{
$input = $request->all();
if ($input['type']['board'] == true) {
$this->boards->createNewBoard($request);
} else {
$this->categories->createNewCategory($request);
}
\Log::notice(\Auth::user()->name . ' created a new board with the name of ' . $input['name']);
\Session::flash("flash_success", "The Forum has been created.");
return response()->json(['result' => 'Success']);
}
示例6: __construct
/** @inheritdoc */
public function __construct(Request $request)
{
// require auth'd users
$this->middleware('auth');
if (\Auth::guest() && null !== ($_subGuid = $request->input('submissionGuid'))) {
// Make sure the request is from hubspot...
if (false !== stripos($_ref = $request->get('http-referrer'), 'info.dreamfactory.com')) {
\Log::notice('bogus referrer on inbound from landing page: ' . $_ref);
}
$this->autoLoginRegistrant($_subGuid, $request->input('pem'));
}
}
示例7: handle
/**
* 受け取ったイベントをTrelloのリストにログする
*
* @param MonitorableInterface $event
* @return void
*/
public function handle(MonitorBaseEvent $event)
{
// サイト状態リスト上のカードを取得
$url = 'https://trello.com/1/lists/' . env('TRELLO_SITES_STATUS_LIST') . '/cards' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN');
if (false === ($result = $this->getter->get($url))) {
\Log::notice('TrelloからWebサイト監視リストの情報が取得できませんでした。');
return;
}
$cards = $this->converter->convert($result);
foreach ($cards as $card) {
if ($card['name'] === $event->url) {
$updateCard = $card;
break;
}
}
if (isset($updateCard)) {
// 既存ラベル色取得、緑と赤は削除
$labels = array_diff(array_column($updateCard['labels'], 'color'), ['green', 'red']);
$labelString = implode(',', $labels);
// 既存カード更新
if ($event instanceof SiteUpped) {
// サイト復活時
// ラベル色緑設定
$url = 'https://trello.com/1/cards/' . $updateCard['id'] . '/labels' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . trim($labelString . ',green', ',');
$result = $this->putter->put($url);
// 説明文からダウン時間情報削除
$url = 'https://trello.com/1/cards/' . $updateCard['id'] . '/desc' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . urlencode(trim(preg_replace('/<.+より停止中 >/u', '', $updateCard['desc'])));
$result = $this->putter->put($url);
} else {
// サイトダウン時
// ラベル色赤設定
$url = 'https://trello.com/1/cards/' . $updateCard['id'] . '/labels' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . trim($labelString . ',red', ',');
$result = $this->putter->put($url);
// 説明文にダウン時間情報追加
$url = 'https://trello.com/1/cards/' . $updateCard['id'] . '/desc' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . urlencode('< ' . $event->time->toDateTimeString() . " より停止中 >\n" . $updateCard['desc']);
$result = $this->putter->put($url);
}
} else {
// 新規カード追加
$url = 'https://trello.com/1/cards/' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&idList=' . env('TRELLO_SITES_STATUS_LIST') . '&name=' . urlencode($event->url) . '&labels=' . ($event instanceof SiteUpped ? 'green' : 'red');
$newCard = $this->converter->convert($this->poster->post($url));
if ($event instanceof SiteDowned) {
// 説明文のダウン時間情報更新
$url = 'https://trello.com/1/cards/' . $newCard['id'] . '/desc' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . urlencode('< ' . $event->time->toDateTimeString() . " より停止中 >\n");
$result = $this->putter->put($url);
}
}
}
示例8: initialize
/**
* @param string $template The name of the template to use for events. These are JSON files and reside in
* [library]/config/schema
*
* @throws InternalServerErrorException
* @return bool|array The schema in array form, FALSE on failure.
*/
public static function initialize($template = self::SCRIPT_EVENT_SCHEMA)
{
if (false !== ($eventTemplate = \Cache::get('scripting.event_schema', false))) {
return $eventTemplate;
}
// Not cached, get it...
$path = Platform::getLibraryConfigPath('/schema') . '/' . trim($template, ' /');
if (is_file($path) && is_readable($path) && false !== ($eventTemplate = file_get_contents($path))) {
if (false !== ($eventTemplate = json_decode($eventTemplate, true)) && JSON_ERROR_NONE == json_last_error()) {
\Cache::add('scripting.event_schema', $eventTemplate, 86400);
return $eventTemplate;
}
}
\Log::notice('Scripting unavailable. Unable to load scripting event schema: ' . $path);
return false;
}
示例9: updateGame
protected function updateGame(\Morpheus\SteamGame $game, \GuzzleHttp\Psr7\Response $response)
{
$body = json_decode($response->getBody());
$result = reset($body);
if ($response->getStatusCode() == 200 && isset($result->success) && $result->success === true) {
$game->steam_store_data = json_encode($result->data);
} elseif ($response->getStatusCode() !== 200) {
\Log::warning('Steam Store API call failed', ['status code' => $response->getStatusCode(), 'game' => $game]);
} elseif (!isset($result->success)) {
\Log::warning('Unexpected Steam Store API response', ['body' => $result, 'game' => $game]);
} else {
\Log::notice('Game not found in Steam Store database', ['game' => $game]);
}
$game->steam_store_updated = date('Y-m-d H:i:s');
$game->save();
}
示例10: query
static function query($query, $connection = null, $file = null, $line = null)
{
if (self::is_logging()) {
$query = str_replace("\n", '', $query);
Log::notice(__FUNCTION__ . ' ' . $query, Log::frame(1));
}
$result = parent::query($query, $connection, $file, $line);
if (empty($result)) {
$backtrace = debug_backtrace(); // Retrieving information about the caller statement.
$caller = isset($backtrace[0]) ? $backtrace[0] : array();
$file = $caller['file'];
$line = $caller['line'];
$message = " sql: $query \n file: $file \n line:$line";
Log::error($message);
}
return $result;
}
示例11: authenticate
public static function authenticate($entitySignature, $identityKey, $resourceKey, $authKey, $identity, $resource)
{
$tag = "Sentry::authenticate()";
Log::notice("{$tag}: <entitySignature={$entitySignature}, {$identityKey}={$identity}, {$resourceKey}={$resource}>");
// TODO: (?) check users session for cached permissions
try {
$sentryBP = BlueprintReader::read($entitySignature);
$entityDAO = new EntityDAO($sentryBP);
$keys = array("{$identityKey}", "{$resourceKey}");
$values = array("{$identity}", "{$resource}");
$matches = $entityDAO->findWhere($keys, $values);
if (0 == count($matches)) {
Log::debug("{$tag}: No permission record was found.");
return false;
} else {
if (1 == count($matches)) {
// found a matching permission record
$entity = $matches[0];
// extract value of $authKey field
$authValue = $entity->get($authKey);
// test for boolean values
if (empty($authValue) || $authValue == 0 || $authValue == "0" || strtoupper($authValue) == "NO" || strtoupper($authValue) == "FALSE") {
Log::debug("{$tag}: {$identityKey} {$identity} does not have permission to access {$resourceKey} {$resource}");
return false;
} else {
if ($authValue == 1 || $authValue == "1" || strtoupper($authValue) == "YES" || strtoupper($authValue) == "TRUE") {
Log::debug("{$tag}: {$identityKey} {$identity} has permission to access {$resourceKey} {$resource}");
return true;
}
}
} else {
if (1 < count($matches)) {
Log::warning("{$tag}: ! More than one permission record was found.");
return false;
}
}
}
} catch (Exception $e) {
Log::error("{$tag}: " . $e->getMessage());
return false;
}
}
示例12: login
/**
* Sets the session values when username and password correct.
* @return boolean Returns true when login was successful.
*/
public function login($username, $password)
{
// Call plugins
Plugins::get()->activate(__METHOD__, 0, func_get_args());
$username_crypt = crypt($username, Settings::get()['username']);
$password_crypt = crypt($password, Settings::get()['password']);
// Check login with crypted hash
if (Settings::get()['username'] === $username_crypt && Settings::get()['password'] === $password_crypt) {
$_SESSION['login'] = true;
$_SESSION['identifier'] = Settings::get()['identifier'];
Log::notice(Database::get(), __METHOD__, __LINE__, 'User (' . $username . ') has logged in from ' . $_SERVER['REMOTE_ADDR']);
return true;
}
// No login
if ($this->noLogin() === true) {
return true;
}
// Call plugins
Plugins::get()->activate(__METHOD__, 1, func_get_args());
// Log failed log in
Log::error(Database::get(), __METHOD__, __LINE__, 'User (' . $username . ') has tried to log in from ' . $_SERVER['REMOTE_ADDR']);
return false;
}
示例13: updateGame
protected function updateGame(\Morpheus\SteamGame $game, \GuzzleHttp\Psr7\Response $response)
{
$body = json_decode($response->getBody());
if ($response->getStatusCode() == 200 && isset($body->result) && $body->result !== false) {
$game->metacritic_name = $body->result->name;
$game->metacritic_score = $body->result->score;
$game->metacritic_userscore = $body->result->userscore;
$game->metacritic_genre = $body->result->genre[0];
$game->metacritic_publisher = $body->result->publisher;
$game->metacritic_developer = $body->result->developer;
$game->metacritic_rating = $body->result->rating;
$game->metacritic_url = $body->result->url;
$game->metacritic_rlsdate = $body->result->rlsdate;
$game->metacritic_summary = $body->result->summary;
} elseif ($response->getStatusCode() !== 200) {
\Log::warning('Metacritic API call failed', ['status code' => $response->getStatusCode(), 'game' => $game]);
} elseif (!isset($body->result)) {
\Log::warning('Unexpected Metacritic API response', ['body' => $body, 'game' => $game]);
} else {
\Log::notice('Game not found in Metacritic database', ['game' => $game]);
}
$game->metacritic_updated = date('Y-m-d H:i:s');
$game->save();
}
示例14: setTags
public function setTags($tags)
{
# Check dependencies
self::dependencies(isset($this->database, $this->photoIDs));
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
# Parse tags
$tags = preg_replace('/(\\ ,\\ )|(\\ ,)|(,\\ )|(,{1,}\\ {0,})|(,$|^,)/', ',', $tags);
$tags = preg_replace('/,$|^,|(\\ ){0,}$/', '', $tags);
if (strlen($tags) > 1000) {
Log::notice($this->database, __METHOD__, __LINE__, 'Length of tags higher than 1000');
return false;
}
# Set tags
$query = Database::prepare($this->database, "UPDATE ? SET tags = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $tags, $this->photoIDs));
$result = $this->database->query($query);
# Call plugins
$this->plugins(__METHOD__, 1, func_get_args());
if (!$result) {
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
return false;
}
return true;
}
示例15: preg_replace
if (!$singleDbForm) { //otherwise just use the main one
iDatabase::select_db($row_course['db_name']);
}
Log::notice('Course db ' . $row_course['db_name']);
foreach ($c_q_list as $query) {
if ($singleDbForm) {
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}
if ($only_test) {
Log::notice("iDatabase::query(".$row_course['db_name'].",$query)");
} else {
$res = iDatabase::query($query);
if ($log) {
Log::notice("In ".$row_course['db_name'].", executed: $query");
}
}
}
$t_wiki = $row_course['db_name'].".wiki";
$t_wiki_conf = $row_course['db_name'].".wiki_conf";
if ($singleDbForm) {
$t_wiki = "$prefix{$row_course['db_name']}_wiki";
$t_wiki_conf = "$prefix{$row_course['db_name']}_wiki_conf";
}
// Update correct page_id to wiki table, actually only store 0
$query = "SELECT id, reflink FROM $t_wiki";
$res_page = iDatabase::query($query);