本文整理汇总了PHP中Log::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::alert方法的具体用法?PHP Log::alert怎么用?PHP Log::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::alert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleError
/**
* May be set as exception handler, i.e. set_exception_handler('alkemann\h2l\handleError');
*
* @param \Throwable $e
*/
function handleError(\Throwable $e)
{
if ($e instanceof \alkemann\h2l\exceptions\InvalidUrl) {
Log::info("InvalidUrl: " . $e->getMessage());
echo (new Error(404, $e->getMessage()))->render();
return;
}
if ($e instanceof \Exception) {
Log::error(get_class($e) . ": " . $e->getMessage());
} elseif ($e instanceof \Error) {
Log::alert(get_class($e) . ": " . $e->getMessage());
}
if (DEBUG && isset($e->xdebug_message)) {
header("Content-type: text/html");
echo '<table>' . $e->xdebug_message . '</table><br>';
dbp('xdebug_message');
d($e);
} elseif (DEBUG) {
header("Content-type: text/html");
echo '<h1>' . $e->getMessage() . '</h1>';
d($e);
} else {
(new Error(500, $e->getMessage()))->render();
}
}
示例2: getPermissions
/**
* Fetch the collection of site permissions.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
protected function getPermissions()
{
try {
return Permission::with('roles')->get();
} catch (\Exception $e) {
\Log::alert('No se pudo registrar los permisos');
return [];
}
}
示例3: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
\Log::alert('Refresh tweets');
$tweet = UpcomingTweet::where('end', '<', date('Y-m-d H:i:s'))->first();
if ($tweet != null) {
$tweet->delete();
$newTweet = UpcomingTweet::orderBy('id', 'asc')->first();
$newTweet->end = date('Y-m-d H:i:s', strtotime('+ 1 hour'));
$newTweet->save();
}
}
示例4: terminate
public function terminate($request, $response)
{
if (!\App::runningInConsole() && \App::bound('veer') && app('veer')->isBooted()) {
$timeToLoad = empty(app('veer')->statistics['loading']) ? 0 : app('veer')->statistics['loading'];
if ($timeToLoad > config('veer.loadingtime')) {
\Log::alert('Slowness detected: ' . $timeToLoad . ': ', app('veer')->statistics());
info('Queries: ', \DB::getQueryLog());
}
\Veer\Jobs\TrackingUser::run();
(new \Veer\Commands\HttpQueueWorkerCommand(config('queue.default')))->handle();
}
}
示例5: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
Log::alert('Executed Cron Job to send weekly mail for pending karma note and meeting requests.');
$KarmaNotePending = "";
$KarmaNotePending = Meetingrequest::whereIn('status', array('pending', 'accepted'))->get();
if (!empty($KarmaNotePending)) {
$test_id = "";
$test_id = Adminoption::Where('option_name', '=', 'Test User Emails')->first();
$test_user_id = $getfintrorecords = array();
if (!empty($test_id)) {
$test_user_id = explode(',', $test_id->option_value);
}
$introducer = $giver = $receiver = $connidgiver = '';
foreach ($KarmaNotePending as $key => $value) {
$diffDate = KarmaHelper::dateDiff(date("Y-m-d H:i:s"), $value->created_at);
if (isset($value->user_id_giver)) {
$giver = in_array($value->user_id_giver, $test_user_id);
}
if (isset($value->user_id_receiver)) {
$receiver = in_array($value->user_id_receiver, $test_user_id);
}
if (isset($value->connection_id_giver)) {
$connidgiver = in_array($value->connection_id_giver, $test_user_id);
}
if (isset($value->user_id_introducer)) {
$introducer = in_array($value->user_id_introducer, $test_user_id);
}
if ($giver != 1 && $receiver != 1 && $connidgiver != 1 && $introducer != 1) {
if ($diffDate->days > 7) {
$meetingtimezone = $value->meetingtimezone;
$meetingdatetime = $value->meetingdatetime;
$user_id_giver = $value->user_id_giver;
$user_id_receiver = $value->user_id_receiver;
$meetingId = $value->id;
$status = $value->status;
$CurrentTimeWithZone = KarmaHelper::calculateTime($meetingtimezone);
if ($CurrentTimeWithZone > $meetingdatetime && $status == 'accepted') {
Queue::push('MessageSender', array('type' => '4', 'user_id_giver' => $user_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
}
if ($status == 'pending') {
//echo"<pre>";print_r($value->id);echo"</pre>";
if (isset($value->user_id_giver)) {
Queue::push('MessageSender', array('type' => '1', 'user_id_giver' => $user_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
} else {
Queue::push('MessageSender', array('type' => '2', 'user_id_giver' => $value->connection_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
}
}
}
}
}
}
}
示例6: authenticate
/**
* Performs user authentication.
*
* @param $username
* @param $password
*
* @return bool
* @throws BadRequestException
*/
public function authenticate($username, $password)
{
if (empty($username) || empty($password)) {
throw new BadRequestException('No username and/or password provided.');
}
$this->userDn = $this->getUserDn($username);
try {
$auth = ldap_bind($this->connection, $this->userDn, $password);
} catch (\Exception $e) {
\Log::alert('Failed to authenticate using LDAP. ' . $e->getMessage());
$auth = false;
}
$this->authenticated = $auth;
return $auth;
}
示例7: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
//get test users id
$getUser = KarmaHelper::getTestUsers();
//print_r($getUser);die;
if (!empty($getUser)) {
foreach ($getUser as $key => $value) {
$helper = User::find($value);
if (!empty($helper)) {
$helper->karmascore = 0;
$helper->save();
}
}
}
Log::alert('Updated test user Karma score.');
}
示例8: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
Log::alert('Executed Cron Job');
$KarmaNotePending = Meetingrequest::where('status', '=', 'confirmed')->where('cronjobflag', '=', '0')->get();
if (!empty($KarmaNotePending)) {
foreach ($KarmaNotePending as $key => $value) {
$meetingtimezone = $value->meetingtimezone;
$meetingdatetime = $value->meetingdatetime;
$user_id_giver = $value->user_id_giver;
$user_id_receiver = $value->user_id_receiver;
$meetingId = $value->id;
$CurrentTimeWithZone = KarmaHelper::calculateTime($meetingtimezone);
//echo "<pre>";print_r($meetingdatetime);echo "</pre>";
//echo "<pre>";print_r($meetingdatetime);echo "</pre>";die();
if ($CurrentTimeWithZone > $meetingdatetime) {
$diffDate = KarmaHelper::dateDiff($CurrentTimeWithZone, $meetingdatetime);
$diffDate = $diffDate->days * 24 + $diffDate->h;
$EmailTriggerTime = Adminoption::where('option_name', '=', 'KarmaNote Email Trigger Time')->first();
if (!empty($EmailTriggerTime)) {
$EmailTriggerTime = $EmailTriggerTime->toArray();
$EmailTriggerTime = $EmailTriggerTime['option_value'];
} else {
$EmailTriggerTime = '24';
}
if ($diffDate >= $EmailTriggerTime) {
//$date = Carbon::now()->addMinutes(5);
Queue::push('MessageSender', array('type' => '4', 'user_id_giver' => $user_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
$Meetingrequest = Meetingrequest::find($meetingId);
$Meetingrequest->cronjobflag = '1';
$Meetingrequest->status = 'over';
$Meetingrequest->save();
DB::table('users_mykarma')->where('entry_id', '=', $meetingId)->update(array('status' => 'over', 'unread_flag' => 'true', 'entry_updated_on' => Carbon::now()));
$messageData = new Message();
$messageData->request_id = $meetingId;
$messageData->sender_id = $user_id_giver;
$messageData->giver_id = $user_id_giver;
$messageData->receiver_id = $user_id_receiver;
$messageData->message_type = 'system';
$messageText = 'Meeting should be over now.';
$messageData->messageText = $messageText;
$messageData->save();
//Queue::push('UpdateUser', array('id' => $user_id,'result' => $result));
}
}
}
}
}
示例9: __construct
public function __construct($dsn = '', $username = '', $password = '')
{
if (null !== ($dumpLocation = config('df.db.freetds.dump'))) {
if (!putenv("TDSDUMP={$dumpLocation}")) {
\Log::alert('Could not write environment variable for TDSDUMP location.');
}
}
if (null !== ($dumpConfLocation = config('df.db.freetds.dumpconfig'))) {
if (!putenv("TDSDUMPCONFIG={$dumpConfLocation}")) {
\Log::alert('Could not write environment variable for TDSDUMPCONFIG location.');
}
}
if (null !== ($confLocation = config('df.db.freetds.sqlanywhere'))) {
if (!putenv("FREETDSCONF={$confLocation}")) {
\Log::alert('Could not write environment variable for FREETDSCONF location.');
}
}
parent::__construct($dsn, $username, $password);
}
示例10: handle
/**
* 受け取ったイベントの内容を実行する
*
* @param MonitorableInterface $event
* @return void
*/
public function handle(CardTaskKicked $event)
{
// 実行中リストへ移動
$url = 'https://trello.com/1/cards/' . $event->id . '/idList' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . env('TRELLO_BATCH_EXECUTING_LIST');
$updatedCard = $this->putter->put($url);
// コマンド実行、実行コード(通常正常時0)が返ってくる
$result = $this->executor->execute($event->task);
// エラーの場合のみ、コメントとして実行結果を追加
if ($result !== 0) {
// メッセージをログしておく
\Log::alert($this->executor->getMessage());
// コメント長の制限は1から16384だが、文字数かバイト数か不明
// そのためコメント長は未チェック
$url = 'https://trello.com/1/cards/' . $event->id . '/actions/comments' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&text=' . urlencode($this->executor->getMessage());
$updatedCard = $this->poster->post($url);
}
// 実行を終えたので、待機リストへ移動
$url = 'https://trello.com/1/cards/' . $event->id . '/idList' . '?key=' . env('TRELLO_KEY') . '&token=' . env('TRELLO_TOKEN') . '&value=' . env('TRELLO_BATCH_WAIT_STACK_LIST');
$updatedCard = $this->putter->put($url);
}
示例11: authenticate
/**
* {@inheritdoc}
*/
public function authenticate($username, $password)
{
if (empty($username) || empty($password)) {
throw new BadRequestException('No username and/or password provided.');
}
$accountSuffix = $this->getAccountSuffix();
try {
$preAuth = ldap_bind($this->connection, $username . '@' . $accountSuffix, $password);
if ($preAuth) {
$this->userDn = $this->getUserDn($username, 'samaccountname');
$auth = ldap_bind($this->connection, $this->userDn, $password);
} else {
$auth = false;
}
} catch (\Exception $e) {
\Log::alert('Failed to authenticate with AD server using LDAP. ' . $e->getMessage());
$auth = false;
}
$this->authenticated = $auth;
return $auth;
}
示例12: getPath
/**
* @return array
* @throws \Exception
*/
protected function getPath()
{
try {
$cors = \DB::table('cors_config')->whereRaw('enabled = 1')->get();
} catch (\Exception $e) {
if ($e instanceof QueryException || $e instanceof \PDOException) {
\Log::alert('Could not get cors config from DB - ' . $e->getMessage());
return [];
} else {
throw $e;
}
}
$path = [];
if (!empty($cors)) {
$path = [];
foreach ($cors as $p) {
$cc = new CorsConfig(['id' => $p->id, 'path' => $p->path, 'origin' => $p->origin, 'header' => $p->header, 'method' => $p->method, 'max_age' => $p->max_age, 'enabled' => $p->enabled]);
$path[$cc->path] = ["allowedOrigins" => explode(',', $cc->origin), "allowedHeaders" => explode(',', $cc->header), "allowedMethods" => $cc->method, "maxAge" => $cc->max_age];
}
}
return $path;
}
示例13: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if ($this->confirm('Are you sure you wish to restore to factory defaults? [y/N] ', false)) {
/**
* Execute the migration tasks here, meaning that we only have to keep the migrations
* up to date and the rest should just work :)
*/
$app_path = str_replace('/app/commands', '', dirname(__FILE__));
// We now need to delete all configuration files from the Nginx configuration directory
$cleanup = new NginxConfig();
$existing_rules = Rule::all();
foreach ($existing_rules as $rule) {
//$cleanup->readConfig($filename)
$cleanup->setHostheaders($rule->hostheader);
$cleanup->deleteConfig(Setting::getSetting('nginxconfpath') . '/' . $cleanup->serverNameToFileName() . '.enabled.conf');
}
// We now re-build the database using the migrations...
$execute = new Executer();
$execute->setApplication('php')->addArgument($app_path . '/artisan')->addArgument('migrate:refresh')->addArgument('--seed')->execute();
// and then restart the daemon as otherwise Nginx will continue to proxy traffic...
$cleanup->reloadConfig();
// We now generate a new API key..
$genkey = new Executer();
$genkey->setApplication('php')->addArgument($app_path . '/artisan')->addArgument('turbine:generatekey')->execute();
/**
* Users can uncommet this code block if they want verbose factory resets!
*
* foreach ($execute->resultAsArray() as $outputline) {
* $this->info($outputline); - Users can uncommet this if they want verbose factory resets!
* }
*
*/
Log::alert('Factory settings restored from the console');
$this->info('Factory settings restored and a new API key has been generated!');
} else {
$this->error('User cancelled!');
}
}
示例14: getActivation
/**
* Actiovation account
*/
public function getActivation($code = null)
{
if (Session::get('activated')) {
return View::make(Config::get('larauth::views.activation'));
}
if (Input::get('code')) {
$code = Input::get('code');
}
if ($code) {
try {
$user = Sentry::findUserByActivationCode($code);
$user->attemptActivation($code);
// добавляем пользователя в группы
foreach (Config::get('larauth::append_groups') as $group) {
try {
$oGroup = Sentry::findGroupByName($group);
} catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
Log::alert("Попытка добавдения пользователя :user_email в несуществующую группу :group", ['user_email' => $user->email, 'group' => $group]);
}
$user->addGroup($oGroup);
}
$data = ['email' => $user->email, 'password' => Cache::pull(md5($user->email)), 'subject' => trans('larauth::larauth.registration_success')];
$this->sendMail(Config::get('larauth::views.mail_registration'), $data);
return Redirect::route('larauth.activation')->with('activated', TRUE);
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
return Redirect::route('larauth.activation')->with('error', trans('larauth::larauth.wrong_activation_code'));
}
}
return View::make(Config::get('larauth::views.activation'), ['error' => Session::get('error'), 'code' => $code]);
}
示例15: StdClass
$raw_settings = Settings::all();
$settings = new StdClass();
foreach ($raw_settings as $raw_setting) {
$settings->{$raw_setting->key} = json_decode($raw_setting->value);
}
$view->with('settings', $settings);
$view->with('uni_department_id', User::getUniDepartment());
$view->with('uni_company_id', User::getUniCompany());
});
Route::get('/', 'AuthController@getLogin');
Route::post('/log-errors', function () {
$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, TRUE);
//convert JSON into array
Log::alert("See below");
Log::alert($input);
});
/*
Route::get('/setup', 'DashboardController@getSetup');
Route::post('/setup', 'DashboardController@postSetup');
*/
Route::get('/clean-everything', 'DashboardController@cleanDB');
Route::get('/activities/all', 'DashboardController@allActivities');
Route::get('/users/all', 'DashboardController@allUsers');
Route::get('/profile', 'AuthController@profile');
Route::get('/login', 'AuthController@getLogin');
Route::get('/register', 'AuthController@getRegister');
Route::get('/forgot-password', 'AuthController@getForgotPassword');
Route::get('/reset/{email}/{code}', 'AuthController@getReset');
Route::get('/activate/{user_id}/{activation_code}', 'AuthController@activateUser');
Route::get('/facebook', 'AuthController@signInWithFacebook');