本文整理汇总了PHP中Cake\Error\Debugger::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::log方法的具体用法?PHP Debugger::log怎么用?PHP Debugger::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Error\Debugger
的用法示例。
在下文中一共展示了Debugger::log方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createStreamDataWithEntity
public function _createStreamDataWithEntity($entity, $entity_type)
{
// if(!$entity_type){
// $entity_type = get_class($entity);
// }
$entity_type_p = $entity_type . 's';
// debug($entity);
// $game = $this->_contains($game)->first();
$success = $entity->format(null, 'feed_push');
if (!$success) {
Debugger::log('It failed after formatting the game');
return false;
}
$base_data = ["object" => $entity_type . ":" . $entity->id, 'type' => "feed-" . strtolower($entity_type_p), 'foreign_id' => $entity_type . ":" . $entity->id, 'display' => $entity->display];
if ($entity_type == 'Game') {
$specific_data = ["verb" => strtolower($entity->game_type_name), 'first_user_image' => $entity->winner_image, 'first_user_id' => $entity->winner_id, 'first_user_score' => $entity->winner_points, 'second_user_image' => $entity->loser_image, 'second_user_id' => $entity->loser_id, 'second_user_score' => $entity->loser_points, 'game_type_name' => $entity->game_type_name, 'time' => $entity->created];
} else {
if ($entity_type == 'Friendship') {
$specific_data = ["verb" => "friend", 'first_user_id' => $entity->first_user_id, 'first_user_image' => $entity->first_user_image, 'second_user_id' => $entity->second_user_id, 'second_user_image' => $entity->second_user_image, 'time' => $entity->modified];
} else {
return false;
}
}
$base_data = array_merge($base_data, $specific_data);
return $base_data;
}
示例2: createAdmin
/**
* @param string $userId
* @return bool
*/
public function createAdmin($userId)
{
$teamMembership = TableRegistry::get('TeamMemberships');
$adminship = new TeamMembership(['role' => 'admin', 'team_id' => $this->id, 'member_id' => $userId]);
$isCurrentMember = $teamMembership->find()->where(['member_id' => $userId, 'team_id' => $this->id])->first();
Debugger::log($isCurrentMember);
if (!empty($isCurrentMember)) {
$adminship->id = $isCurrentMember->id;
}
if (!$teamMembership->save($adminship)) {
return false;
}
return true;
}
示例3: ajaxResponseStatusCallback
public function ajaxResponseStatusCallback($uniqueId)
{
try {
$DEFAULT_URL = 'https://ens.firebaseio.com/';
$DEFAULT_TOKEN = Configure::read('Firebase.token');
$DEFAULT_PATH = '/call';
$firebase = new \Firebase\FirebaseLib($DEFAULT_URL, $DEFAULT_TOKEN);
$sendQueueTable = TableRegistry::get('SendQueues');
$sendQueue = $sendQueueTable->find()->where(['unique_id' => $uniqueId])->contain(['Audios']);
if (!$sendQueue->count()) {
throw new Exception('Cannot find queue.');
}
$queue = $sendQueue->all()->first();
// Get number id
$numberId = $firebase->get($DEFAULT_PATH . '/' . $queue->send_queue_id . '/number_match/' . $this->request->data['CallSid']);
// Set as Success
$firebase->set($DEFAULT_PATH . '/' . $queue->send_queue_id . '/numbers/' . $numberId . '/call_status', 3);
Debugger::log($this->request->data);
$response['status'] = 1;
} catch (\Exception $ex) {
$response['status'] = 0;
$response['message'] = $ex->getMessage();
}
$this->set(compact('response'));
$this->set('_serialize', ['response']);
}
示例4: testLogDepth
/**
* test log() depth
*
* @return void
*/
public function testLogDepth()
{
$mock = $this->getMock('Cake\\Log\\Engine\\BaseLog', ['log']);
Log::config('test', ['engine' => $mock]);
$mock->expects($this->at(0))->method('log')->with('debug', $this->logicalAnd($this->stringContains('DebuggerTest::testLog'), $this->stringContains('test'), $this->logicalNot($this->stringContains('val'))));
$val = ['test' => ['key' => 'val']];
Debugger::log($val, 'debug', 0);
}
示例5: afterUninstall
/**
* Triggered after plugin is removed from DB and after its directory was removed.
*
* @param \Cake\Event\Event $event
* @return void
*/
public function afterUninstall(Event $event)
{
Debugger::log('afterUninstall: ' . $this->_line());
}
示例6: main
/**
* Start the shell and interactive console.
*
* @return int|void
*/
public function main()
{
$sa_table = TableRegistry::get('Friendships');
$fitbit_accounts = $sa_table->find()->matching('Froms.SocialAccounts', function ($q) {
return $q->where(['provider' => 'Fitbit']);
})->contain(['Tos']);
$game = TableRegistry::get('Games');
$controller = new AppController();
$stream = $controller->loadComponent('Stream');
$tm_table = TableRegistry::get('TempMembers');
debug(Time::now()->i18nFormat('yyyy-MM-dd 00:00:00'));
$lr_table = TableRegistry::get('LinkedRecords');
foreach ($fitbit_accounts as $fitbit_account) {
//find all pairings of fitbit friends
if (empty($social_accounts = $fitbit_account['to']['social_accounts'])) {
continue;
}
$fitbit_social_account = false;
foreach ($social_accounts as $social_account) {
if ($social_account->provider == 'Fitbit') {
$fitbit_social_account = $social_account->id;
}
}
if (!$fitbit_social_account) {
continue;
}
//
//find todays linked record
$to = $lr_table->find()->where(['social_account_id' => $fitbit_social_account, 'associated_date' => Time::now()->i18nFormat('yyyy-MM-dd 00:00:00')]);
if (!$to->first()) {
continue;
}
//
// debug($to->first());
// return;
$to_mem = ['member_id' => $fitbit_account->to->id, 'points' => null, 'role' => 'member', 'linked_record_id' => $to->first()->id];
if (empty($social_accounts = $fitbit_account['from']['social_accounts'])) {
continue;
}
$fitbit_social_account = false;
foreach ($social_accounts as $social_account) {
if ($social_account->provider == 'Fitbit') {
$fitbit_social_account = $social_account->id;
}
}
if (!$fitbit_social_account) {
continue;
}
$from = $lr_table->find()->where(['social_account_id' => $fitbit_social_account, 'associated_date' => Time::now()->i18nFormat('yyyy-MM-dd 00:00:00')]);
if (!$from->first()) {
continue;
}
$from_mem = ['member_id' => $fitbit_account->from->id, 'points' => null, 'role' => 'member', 'linked_record_id' => $from->first()->id];
$game_array = ['status' => 'complete', 'score_type' => 'score', 'game_type_id' => '81e376fa-9f08-4814-82e7-00a2cbf1935b', 'game_memberships' => [$to_mem, $from_mem]];
$new_game = $game->newEntity($game_array);
if ($game->save($new_game)) {
$base_data = $stream->_createStreamData($new_game->id, 'Game');
Debugger::log($base_data);
if ($base_data) {
if (!$tm_table->exists(['id' => $base_data['first_user_id']])) {
$stream->_pushToStream($base_data, $base_data['first_user_id']);
}
if (!$tm_table->exists(['id' => $base_data['second_user_id']])) {
$stream->_pushToStream($base_data, $base_data['second_user_id']);
}
}
}
}
}
示例7: _beforeRender_View
public function _beforeRender_View(\Cake\Event\Event $event)
{
Debugger::log($this->request->query('pane'));
$this->set('pane', $this->request->query('pane') ? $this->request->query('pane') : 'feed');
}
示例8: snapshot
/**
* Stores some bootstrap-handy information into a persistent file.
*
* Information is stored in `TMP/snapshot.php` file, it contains
* useful information such as enabled languages, content types slugs, installed
* plugins, etc.
*
* You can read this information using `Configure::read()` as follow:
*
* ```php
* Configure::read('QuickApps.<option>');
* ```
*
* Or using the `quickapps()` global function:
*
* ```php
* quickapps('<option>');
* ```
*
* @return void
*/
function snapshot()
{
if (Cache::config('default')) {
Cache::clear(false, 'default');
}
if (Cache::config('_cake_core_')) {
Cache::clear(false, '_cake_core_');
}
if (Cache::config('_cake_model_')) {
Cache::clear(false, '_cake_model_');
}
$versionPath = QUICKAPPS_CORE . 'VERSION.txt';
$snapshot = ['version' => null, 'content_types' => [], 'plugins' => [], 'options' => [], 'languages' => [], 'aspects' => []];
if (is_readable($versionPath)) {
$versionFile = file($versionPath);
$snapshot['version'] = trim(array_pop($versionFile));
} else {
die(sprintf('Missing file: %s', $versionPath));
}
if (ConnectionManager::config('default')) {
if (!TableRegistry::exists('SnapshotPlugins')) {
$PluginTable = TableRegistry::get('SnapshotPlugins', ['table' => 'plugins']);
} else {
$PluginTable = TableRegistry::get('SnapshotPlugins');
}
if (!TableRegistry::exists('SnapshotContentTypes')) {
$ContentTypesTable = TableRegistry::get('SnapshotContentTypes', ['table' => 'content_types']);
} else {
$ContentTypesTable = TableRegistry::get('SnapshotContentTypes');
}
if (!TableRegistry::exists('SnapshotLanguages')) {
$LanguagesTable = TableRegistry::get('SnapshotLanguages', ['table' => 'languages']);
} else {
$LanguagesTable = TableRegistry::get('SnapshotLanguages');
}
if (!TableRegistry::exists('SnapshotOptions')) {
$OptionsTable = TableRegistry::get('SnapshotOptions', ['table' => 'options']);
} else {
$OptionsTable = TableRegistry::get('SnapshotOptions');
}
$PluginTable->schema(['value' => 'serialized']);
$OptionsTable->schema(['value' => 'serialized']);
$plugins = $PluginTable->find()->select(['name', 'package', 'status'])->order(['ordering' => 'ASC', 'name' => 'ASC'])->all();
$contentTypes = $ContentTypesTable->find()->select(['slug'])->all();
$languages = $LanguagesTable->find()->where(['status' => 1])->order(['ordering' => 'ASC'])->all();
$options = $OptionsTable->find()->select(['name', 'value'])->where(['autoload' => 1])->all();
foreach ($contentTypes as $contentType) {
$snapshot['content_types'][] = $contentType->slug;
}
foreach ($options as $option) {
$snapshot['options'][$option->name] = $option->value;
}
foreach ($languages as $language) {
list($languageCode, $countryCode) = localeSplit($language->code);
$snapshot['languages'][$language->code] = ['name' => $language->name, 'locale' => $language->code, 'code' => $languageCode, 'country' => $countryCode, 'direction' => $language->direction, 'icon' => $language->icon];
}
} else {
$plugins = [];
foreach (Plugin::scan() as $plugin => $path) {
$plugins[] = new Entity(['name' => $plugin, 'status' => true, 'package' => 'quickapps-plugins']);
}
}
$folder = new Folder(QUICKAPPS_CORE . 'src/Aspect/');
foreach ($folder->read(false, false, true)[1] as $classFile) {
$className = basename(preg_replace('/\\.php$/', '', $classFile));
if (!in_array($className, ['AppAspect', 'Aspect'])) {
$snapshot['aspects'][] = "CMS\\Aspect\\{$className}";
}
}
foreach ($plugins as $plugin) {
$pluginPath = false;
if (isset(Plugin::scan()[$plugin->name])) {
$pluginPath = Plugin::scan()[$plugin->name];
}
if ($pluginPath === false) {
Debugger::log(sprintf('Plugin "%s" was found in DB but QuickAppsCMS was unable to locate its root directory.', $plugin->name));
continue;
}
if (!Plugin::validateJson("{$pluginPath}/composer.json")) {
//.........这里部分代码省略.........