本文整理汇总了PHP中Log::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::info方法的具体用法?PHP Log::info怎么用?PHP Log::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* updates title and description of an activity
* @param array $activityDetails
* @param Activity $activity
* @return bool
*/
public function update(array $activityDetails, Activity $activity)
{
try {
$this->database->beginTransaction();
$this->stepTwoRepo->update($activityDetails, $activity);
$this->database->commit();
$this->logger->info('Step Two Completed!', ['for' => [$activity->title, $activity->description]]);
$this->logger->activity("activity.step_two_completed", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
return true;
} catch (Exception $exception) {
$this->database->rollback();
$this->logger->error($exception, ['stepTwo' => $activityDetails]);
}
return false;
}
示例2: factory
public static function factory($config = array())
{
// The following values are required when creating the client
$required = array('base_url', 'username', 'password');
// Merge in default settings and validate the config
$config = Collection::fromConfig($config, array(), $required);
// Create a new sData client
$client = new self($config->get('base_url'), $config);
// JSON by default
$client->setDefaultOption('query/format', 'json');
// Authentication
$client->setDefaultOption('auth', array($config->get('username'), $config->get('password'), 'Basic'));
// Strip the BOM from results
$client->addSubscriber(new StripBomPlugin());
// Optional logging
if ($config->get('log')) {
$client->getEventDispatcher()->addListener('request.before_send', function (Event $event) {
$req = $event['request'];
\Log::info('sData', ['request' => $req->getMethod() . ' ' . $req->getResource()]);
});
}
// Set the service description
$services = \Config::get('sdata::services');
if (!empty($services)) {
$client->setDescription(ServiceDescription::factory($services));
}
// Done
return $client;
}
示例3: update_judge_status
function update_judge_status()
{
if (!isset($_REQUEST['judgeid'], $_REQUEST['status'])) {
return;
}
$status = $_REQUEST['status'];
if ($_REQUEST['judgeid'] == 'all') {
JudgeDaemon::set_status_all($status);
$this->add_message('judge', 'confirm', 'Status of all judges set to ' . JudgeDaemon::status_to_text($status));
Log::info('Status of all judges set to ' . JudgeDaemon::status_to_text($status));
} else {
$judge = JudgeDaemon::by_id($_REQUEST['judgeid']);
if (!$judge) {
return;
}
// it already died
if ($status == JudgeDaemon::MUST_STOP && $judge->is_inactive()) {
$status = JudgeDaemon::STOPPED;
// stop right now
}
$judge->set_status($status);
$this->add_message('judge', 'confirm', 'Status of judge "' . $judge->name . '" set to ' . $judge->status_text());
Log::info('Status of judge set to ' . $judge->status_text(), null, $judge->name);
}
}
示例4: store
/**
* save new activity from wizard
* @param array $identifier
* @param $defaultFieldValues
* @return bool
*/
public function store(array $identifier, $defaultFieldValues)
{
try {
$this->database->beginTransaction();
$result = $this->activityRepo->store($identifier, $defaultFieldValues, $this->auth->user()->organization->id);
$this->activityRepo->saveDefaultValues($result->id, $defaultFieldValues);
$this->database->commit();
$this->logger->info('Activity identifier added!', ['for' => $identifier['activity_identifier']]);
$this->logger->activity("activity.activity_added", ['identifier' => $identifier['activity_identifier'], 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
return $result;
} catch (Exception $exception) {
$this->database->rollback();
$this->logger->error($exception, ['ActivityIdentifier' => $identifier]);
}
return false;
}
示例5: buildNextWeekTag
/**
* 金曜日になると今週の週報タグを生成する
*/
public function buildNextWeekTag()
{
\Log::info('Start generate tag of This week. ');
$dt = new Carbon();
// $dt->setTestNow($dt->createFromDate(2015, 5, 31));
if ($dt->now()->dayOfWeek === Carbon::FRIDAY) {
//翌月
$nextMonth = $dt->parse('next month')->month;
// 現在が何週目か
\Log::info('今日は' . $dt->now()->month . '月の第' . $dt->now()->weekOfMonth . '週目です');
//今週の金曜を取得
$thisFriday = $dt->parse('this friday');
\Log::info('来週の金曜は' . $thisFriday);
// 月またぎの場合
if ($thisFriday->month === $nextMonth) {
\Log::info($thisFriday->year . '年の' . $thisFriday->month . '月の第' . $thisFriday->weekOfMonth . '週目です');
$nextWeekTag = '週報@' . $thisFriday->year . '年' . $thisFriday->month . '月第' . $thisFriday->weekOfMonth . '週';
$this->tag->tag = $nextWeekTag;
$this->tag->save();
} else {
\Log::info('翌週は' . $thisFriday->month . '月の第' . $thisFriday->weekOfMonth . '週目です');
$nextWeekTag = '週報@' . $thisFriday->year . '年' . $thisFriday->month . '月第' . $thisFriday->weekOfMonth . '週';
$this->tag->tag = $nextWeekTag;
$this->tag->save();
}
\Log::info('End generate tag');
} else {
\Log::info('Today is not Friday.');
}
}
示例6: store
/**
* Store a newly created qa in storage.
*
* @return Response
*/
public function store()
{
$qa = new Qa();
Session::flash('successMessage', 'Your post has been saved.');
Log::info(Input::all());
return $this->validateAndSave($qa);
}
示例7: processRequest
/**
* @return bool|mixed
* @throws \DreamFactory\Core\Events\Exceptions\ScriptException
* @throws \DreamFactory\Core\Exceptions\BadRequestException
* @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
*/
protected function processRequest()
{
// Now all actions must be HTTP verbs
if (!Verbs::contains($this->action)) {
throw new BadRequestException('The action "' . $this->action . '" is not supported.');
}
$logOutput = $this->request->getParameterAsBool('log_output', true);
$data = ['request' => $this->request->toArray()];
$output = null;
$result = ScriptEngineManager::runScript($this->content, 'script.' . $this->name, $this->engineConfig, $this->scriptConfig, $data, $output);
if (!empty($output) && $logOutput) {
\Log::info("Script '{$this->name}' output:" . PHP_EOL . $output . PHP_EOL);
}
// Bail on errors...
if (is_array($result) && isset($result['script_result'], $result['script_result']['error'])) {
throw new InternalServerErrorException($result['script_result']['error']);
}
if (is_array($result) && isset($result['exception'])) {
throw new InternalServerErrorException(ArrayUtils::get($result, 'exception', ''));
}
// The script runner should return an array
if (is_array($result) && isset($result['__tag__'])) {
$scriptResult = ArrayUtils::get($result, 'script_result', []);
return $scriptResult;
} else {
Log::error(' * Script did not return an array: ' . print_r($result, true));
}
return $output;
}
示例8: _loadFromFile
function _loadFromFile($view, $file, $moduleName)
{
$variables = array();
if (!file_exists($file)) {
$this->_fatalError("ModuleBuilderParser: required viewdef file {$file} does not exist");
}
Log::info('ModuleBuilderParser->_loadFromFile(): file=' . $file);
require $file;
// loads in a $viewdefs
// Check to see if we have the module name set as a variable rather than embedded in the $viewdef array
// If we do, then we have to preserve the module variable when we write the file back out
// This is a format used by ModuleBuilder templated modules to speed the renaming of modules
// Traditional Sugar modules don't use this format
// We must do this in ParserModifyLayout (rather than just in ParserBuildLayout) because we might be editing the layout of a MB created module in Studio after it has been deployed
$moduleVariables = array('module_name', '_module_name', 'OBJECT_NAME', '_object_name');
foreach ($moduleVariables as $name) {
if (isset(${$name})) {
$variables[$name] = ${$name};
}
}
$viewVariable = $this->_defMap[strtolower($view)];
// Now tidy up the module name in the viewdef array
// MB created definitions store the defs under packagename_modulename and later methods that expect to find them under modulename will fail
$defs = ${$viewVariable};
if (isset($variables['module_name'])) {
$mbName = $variables['module_name'];
if ($mbName != $moduleName) {
Log::debug('ModuleBuilderParser->_loadFromFile(): tidying module names from ' . $mbName . ' to ' . $moduleName);
$defs[$moduleName] = $defs[$mbName];
unset($defs[$mbName]);
}
}
// Log::debug('ModuleBuilderParser->_loadFromFile(): '.print_r($defs,true));
return array('viewdefs' => $defs, 'variables' => $variables);
}
示例9: startQueryLogger
private function startQueryLogger()
{
\DB::listen(function ($event) {
$bindings = $event->bindings;
$time = $event->time;
$query = $event->sql;
$data = compact('bindings', 'time');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
if (is_object($binding) && $binding instanceof \DateTime) {
$bindings[$i] = '\'' . $binding->format('Y-m-d H:i:s') . '\'';
} elseif (is_null($binding)) {
$bindings[$i] = 'NULL';
} elseif (is_bool($binding)) {
$bindings[$i] = $binding ? '1' : '0';
} elseif (is_string($binding)) {
$bindings[$i] = "'{$binding}'";
}
}
$query = preg_replace_callback('/\\?/', function () use(&$bindings) {
return array_shift($bindings);
}, $query);
\Log::info($query, $data);
});
}
示例10: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
// Log what we are going to do in the laravel.log file
\Log::info('Started command ' . $this->name, array('src' => __CLASS__));
// Get the keys that are not disabled and process them.
foreach (\SeatKey::where('isOk', '=', 1)->get() as $key) {
// It is important to know the type of key we are working
// with so that we may know which API calls will
// apply to it. For that reason, we run the
// Seat\EveApi\BaseApi\determineAccess()
// function to get this.
$access = EveApi\BaseApi::determineAccess($key->keyID);
// If we failed to determine the access type of the
// key, continue to the next key.
if (!isset($access['type'])) {
//TODO: Log this key's problems and disable it
continue;
}
// If the key is a of type 'Character', then we can
// continue to submit a updater job
if ($access['type'] == 'Character') {
// Do a fresh AccountStatus lookup
Account\AccountStatus::update($key->keyID, $key->vCode);
// Once the fresh account status lookup is done, call the
// addToQueue helper to queue a new job.
\App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Character', $key->keyID, $key->vCode, 'Character', 'Eve');
}
}
}
示例11: registerFunction
/**
* This method registers all the functions on the service class
*
*/
protected function registerFunction()
{
Log::info('Begin: registry->registerFunction');
parent::registerFunction();
Log::info('END: registry->registerFunction');
// END OF REGISTER FUNCTIONS
}
示例12: action_settings
/**
* Setting the display of pages
*
* @uses Arr::merge
* @uses Config::load
* @uses Message::success
*/
public function action_settings()
{
$this->title = __('Page Settings');
$post = Config::load('page');
$action = Route::get('admin/page')->uri(array('action' => 'settings'));
$vocabs = array(__('none'));
$view = View::factory('admin/page/settings')->set('vocabs', $vocabs)->set('post', $post)->set('action', $action);
$vocabs = Arr::merge($vocabs, ORM::factory('term')->where('lft', '=', 1)->where('type', '=', 'page')->find_all()->as_array('id', 'name'));
if ($this->valid_post('page_settings')) {
unset($_POST['page_settings'], $_POST['_token'], $_POST['_action']);
$cats = $post->get('category', array());
foreach ($_POST as $key => $value) {
if ($key == 'category') {
$terms = array_diff($cats, $value);
if ($terms) {
DB::delete('posts_terms')->where('parent_id', 'IN', array_values($terms))->execute();
}
}
$post->set($key, $value);
}
Log::info('Page Settings updated.');
Message::success(__('Page Settings updated!'));
$this->request->redirect(Route::get('admin/page')->uri(array('action' => 'settings')), 200);
}
$this->response->body($view);
}
示例13: action_login
public function action_login()
{
if ($this->_auth->logged_in()) {
// redirect to the user account
$this->request->redirect(Route::get('admin')->uri(), 200);
}
// Disable sidebars on login page
$this->_sidebars = FALSE;
$this->title = __('Sign In');
$user = ORM::factory('user');
// Create form action
$destination = isset($_GET['destination']) ? $_GET['destination'] : 'admin';
$params = array('action' => 'login');
$action = Route::get('admin/login')->uri($params) . URL::query(array('destination' => $destination));
if ($layout = kohana::find_file('views', 'layouts/login')) {
$this->template->set_filename('layouts/login');
}
$view = View::factory('admin/login')->set('use_username', Config::get('auth.username'))->set('post', $user)->set('action', $action)->bind('errors', $this->_errors);
if ($this->valid_post('login')) {
try {
// Check Auth
$user->login($this->request->post());
// If the post data validates using the rules setup in the user model
Message::success(__('Welcome, %title!', array('%title' => $user->nick)));
Log::info('User :name logged in.', array(':name' => $user->name));
// redirect to the user account
$this->request->redirect(isset($_GET['destination']) ? $_GET['destination'] : 'admin', 200);
} catch (Validation_Exception $e) {
$this->_errors = $e->array->errors('login', TRUE);
}
}
$this->response->body($view);
}
示例14: myErrorHandler
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
if (!class_exists('Log')) {
require YYUC_LIB . 'sys/log.php';
}
$err_msg = "信息:{$errno}。内容:{$errstr},发生在文件{$errfile}的{$errline}行";
switch ($errno) {
case E_USER_ERROR:
Log::error($err_msg);
if (Conf::$is_developing) {
echo $err_msg;
}
exit(1);
break;
case E_USER_WARNING:
Log::warn($err_msg);
break;
case E_USER_NOTICE:
Log::info($err_msg);
break;
default:
Log::info($err_msg);
break;
}
return true;
}
示例15: action_view
/**
* List of pages (blogs/posts/etc.) with a specific tag
*
* @throws HTTP_Exception_404
*
* @uses Log::add
* @uses Text::ucfirst
* @uses ACL::check
* @uses Meta::links
* @uses URL::canonical
* @uses Route::url
*/
public function action_view()
{
$id = (int) $this->request->param('id', 0);
$tag = ORM::factory('tag', $id);
if (!$tag->loaded()) {
throw HTTP_Exception::factory(404, 'Tag :tag not found!', array(':tag' => $id));
}
$this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
$view = View::factory('tag/view')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts);
$posts = $tag->posts;
if (!ACL::check('administer tags') and !ACL::check('administer content')) {
$posts->where('status', '=', 'publish');
}
$total = $posts->reset(FALSE)->count_all();
if ($total == 0) {
Log::info('No posts found.');
$this->response->body(View::factory('page/none'));
return;
}
$pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 15, 'uri' => $tag->url));
$posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$this->response->body($view);
// Set the canonical and shortlink for search engines
if ($this->auto_render === TRUE) {
Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
Meta::links(Route::url('tag', array('action' => 'view', 'id' => $tag->id)), array('rel' => 'shortlink'));
}
}