本文整理汇总了PHP中log_warning函数的典型用法代码示例。如果您正苦于以下问题:PHP log_warning函数的具体用法?PHP log_warning怎么用?PHP log_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_warning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* initialize exception handler list
*/
public function init()
{
// if this object is already initialized, do nothing
if ($this->init) {
return TRUE;
}
// if our sandbox is not loaded, do nothing
if (!$this->sandbox->isLoaded()) {
return FALSE;
}
// read initialization options from sandbox profile
$this->log_enabled = ub($this->sandbox->getProfile()->getBoolean('LOG_ENABLED', FALSE));
$this->log_level = us($this->sandbox->getProfile()->getString('LOG_LEVEL', 'W'));
$this->log_no_buffer = ub($this->sandbox->getProfile()->getBoolean('LOG_NO_BUFFER', FALSE));
$this->log_tag_filters = uv($this->sandbox->getProfile()->getArray('LOG_TAG_FILTERS', array()));
$this->log_loggers = uv($this->sandbox->getProfile()->getArray('LOG_LOGGERS', array()));
$this->loggers = array();
// create loggers on demand
if ($this->log_loggers) {
foreach ($this->log_loggers as $logger_name) {
if (strlen($logger_name) === 0) {
continue;
}
if (!isset($this->loggers[$logger_name])) {
$logger = $this->sandbox->createObject($logger_name, 'logger', array(), 'Charcoal_ILogger');
self::register($logger_name, $logger);
} else {
log_warning("system,debug,error", "Logger[{$logger_name}] is already registered!");
}
}
}
$this->init = TRUE;
return TRUE;
}
示例2: process
function process($info)
{
$commit_info = $info['commit_info'];
$module = $info['module'];
$git_path = $info['git_path'];
$svn_path = $info['svn_path'];
if (empty($module) || empty($git_path) || empty($svn_path)) {
log_warning(sprintf("some parameter is invalid. " . "module[%s] git_path[%s] svn_path[%s]", $module, $git_path, $svn_path));
return false;
}
$svn_path_name = basename($svn_path);
if ($svn_path_name != $module) {
log_warning("svn module does not match git module", $svn_path_name, $module);
return false;
}
if ($commit_info['ref'] != 'refs/heads/master') {
log_debug("omit non master commit");
return true;
}
$pwd = dirname(__FILE__);
$cmd = "(source ~/.bashrc && cd {$pwd} && nohup ./git2svn.sh {$module} {$git_path} {$svn_path}) >./log/job.\$\$.log 2>&1 & echo \$!";
exec($cmd, $output, $ret);
log_debug(sprintf("start background sync script. cmd[%s] ret[%s] job-pid[%s]", $cmd, $ret, $output[0]));
if ($ret == 0) {
return true;
} else {
return false;
}
}
示例3: index
/**
* パスワードリマインダ.
*
* @param Application $app
* @param Request $request
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function index(Application $app, Request $request)
{
$builder = $app['form.factory']->createNamedBuilder('', 'forgot');
$event = new EventArgs(array('builder' => $builder), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_FORGOT_INDEX_INITIALIZE, $event);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$Customer = $app['eccube.repository.customer']->getActiveCustomerByEmail($form->get('login_email')->getData());
if (!is_null($Customer)) {
// リセットキーの発行・有効期限の設定
$Customer->setResetKey($app['eccube.repository.customer']->getUniqueResetKey($app))->setResetExpire(new \DateTime('+' . $app['config']['customer_reset_expire'] . ' min'));
// リセットキーを更新
$app['orm.em']->persist($Customer);
$app['orm.em']->flush();
$event = new EventArgs(array('form' => $form, 'Customer' => $Customer), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_FORGOT_INDEX_COMPLETE, $event);
// 完了URLの生成
$reset_url = $app->url('forgot_reset', array('reset_key' => $Customer->getResetKey()));
// メール送信
$app['eccube.service.mail']->sendPasswordResetNotificationMail($Customer, $reset_url);
// ログ出力
$app['monolog']->addInfo('send reset password mail to:' . "{$Customer->getId()} {$Customer->getEmail()} {$request->getClientIp()}");
} else {
log_warning('Un active customer try send reset password email: ', array('Enter email' => $form->get('login_email')->getData()));
}
return $app->redirect($app->url('forgot_complete'));
}
return $app->render('Forgot/index.twig', array('form' => $form->createView()));
}
示例4: loadConfig
/**
* load config
*
* @param string|Charcoal_String $key config key
*
* @return mixed configure data
*/
public function loadConfig($key)
{
// Charcoal_ParamTrait::validateString( 1, $key );
$source = $key . '.ini';
$is_debug = b($this->debug)->isTrue();
$result = NULL;
if (!is_file($source)) {
if ($is_debug) {
print "ini file[{$source}] does not exist." . eol();
log_warning("system, debug, config", "config", "ini file[{$source}] does not exist.");
}
} else {
// read ini file
$result = @parse_ini_file($source, TRUE);
if ($is_debug) {
print "[{$source}] parse_ini_file({$source})=" . eol();
ad($result);
if ($result === FALSE) {
print "parse_ini_file failed: [{$source}]" . eol();
log_warning("system, debug, config", "config", "parse_ini_file failed: [{$source}]");
} else {
log_debug("system, debug, config", "config", "read ini file[{$source}]:" . print_r($result, true));
}
}
}
return $result;
}
示例5: handleException
/**
* execute exception handlers
*
* @param Exception $e exception to handle
*
* @return boolean TRUE means the exception is handled, otherwise FALSE
*/
public function handleException($e)
{
Charcoal_ParamTrait::validateException(1, $e);
if ($e instanceof Charcoal_HttpStatusException) {
$status_code = $e->getStatusCode();
// Show HTTP error document
self::showHttpErrorDocument($status_code);
log_warning('system,error', 'exception', "http_exception: status_code={$status_code}");
return TRUE;
}
return FALSE;
}
示例6: blockComment
protected function blockComment()
{
if (starts_with($this->line, '//')) {
$this->interrupted = true;
} elseif (starts_with($this->line, '#')) {
log_warning('Using the # symbol for comments is deprecated');
$this->interrupted = true;
} elseif (starts_with($this->line, '/*')) {
if (ends_with($this->line, '*/')) {
return null;
}
$this->isComment = true;
} elseif (ends_with($this->line, '*/')) {
$this->isComment = false;
}
}
示例7: loadModule
public static function loadModule($sandbox, $module_path, $task_manager)
{
// Charcoal_ParamTrait::validateSandbox( 1, $sandbox );
// Charcoal_ParamTrait::validateStringOrObjectPath( 2, $module_path );
// Charcoal_ParamTrait::validateImplements( 3, 'Charcoal_ITaskManager', $task_manager );
try {
log_debug('debug, event', "loading module: {$module_path}");
if ($module_path instanceof Charcoal_ObjectPath) {
$module_path = $module_path->toString();
} else {
$module_path = us($module_path);
}
// check if module is already loaded
if (isset(self::$loaded_paths[$module_path])) {
log_warning('system, event, debug', "module[{$module_path}] is already loaded.");
return;
}
/** @var Charcoal_IModule $module */
/** @var Charcoal_Sandbox $sandbox */
$module = $sandbox->createObject($module_path, 'module', array(), 'Charcoal_IModule', 'Charcoal_SimpleModule');
// load module tasks
$loaded_tasks = $module->loadTasks($task_manager);
// load module events source code
$loaded_events = $module->loadEvents($task_manager);
// if no tasks or events are loaded, you maybe passed a wrong module path
if (empty($loaded_tasks) && empty($loaded_events)) {
_throw(new Charcoal_ModuleLoaderException($module_path, "no tasks and events are loaded."));
}
// load required modules
$required_modules = $module->getRequiredModules();
if ($required_modules) {
$loaded_modules = NULL;
foreach ($required_modules as $module_name) {
if (strlen($module_name) === 0) {
continue;
}
self::loadModule($sandbox, $module_name, $task_manager);
}
}
self::$loaded_paths[$module_path] = $module_path;
log_debug('debug, event, module', "loaded module: {$module_path}");
} catch (Exception $ex) {
_catch($ex);
_throw(new Charcoal_ModuleLoaderException($module_path, "failed to load module.", $ex));
}
}
示例8: Engine_ErrorHandler
function Engine_ErrorHandler($errno, $errstr, $errfile, $errline)
{
switch ($errno) {
case E_ERROR:
log_error($errstr, $errfile, $errline);
break;
case E_PARSE:
log_error($errstr, $errfile, $errline);
break;
case E_WARNING:
log_warning($errstr, $errfile, $errline);
break;
case E_NOTICE:
log_notice($errstr, $errfile, $errline);
break;
default:
log_notice($errstr, $errfile, $errline);
}
}
示例9: read_csv_file_from_handle
function read_csv_file_from_handle($file_handle, $seperator)
{
$result = array();
$column_names = array();
$line_index = 0;
while (!feof($file_handle)) {
$current_parts = fgetcsv($file_handle, 0, $seperator);
if (empty($current_parts)) {
continue;
}
$line_index += 1;
if ($line_index < 2) {
$seperators = array("\t", ";", "|");
foreach ($seperators as $seperator_candidate) {
if (count($current_parts) >= 2) {
continue;
}
$seperator = $seperator_candidate;
rewind($file_handle);
$current_parts = fgetcsv($file_handle, 0, $seperator);
}
$column_names = array_map('trim', $current_parts);
continue;
}
$row = array();
$column_index = 0;
foreach ($column_names as $column_name) {
if (!empty($column_name)) {
if (isset($current_parts[$column_index])) {
$row[$column_name] = $current_parts[$column_index];
} else {
$row[$column_name] = null;
log_warning($line_index, "No value found in the '{$column_name}' column", 'http://wiki.github.com/petewarden/openheatmap/no-value-found-in-column');
}
}
$column_index += 1;
}
$result[] = $row;
}
return $result;
}
示例10: route
/**
* Lookup routing rules
*
* @return array returns combined array, FALSE if any pattern is matched.
*/
public function route(Charcoal_IRequest $request, Charcoal_IRoutingRule $rule)
{
// Get path info
//$request_uri = $_SERVER["REQUEST_URI"];
//$script_name = $_SERVER["SCRIPT_NAME"];
//$dir_name = dirname($script_name);
//$pos = strpos( $request_uri, $dir_name );
//$url = substr( $request_uri, $pos + strlen($dir_name) );
$url = rtrim($_SERVER["REQUEST_URI"], '/');
log_info('debug,router', "routing started. URL=[{$url}]");
$proc_key = $this->getSandbox()->getProfile()->getString('PROC_KEY', 'proc');
$rule_keys = $rule->getKeys();
if ($rule_keys && is_array($rule_keys)) {
log_info('debug,router', "rule keys=[" . implode(",", $rule_keys) . "]");
foreach ($rule_keys as $pattern) {
$proc = $rule->getProcPath(s($pattern));
log_info('debug,router', "pattern=[{$pattern}] proc=[{$proc}]");
if ($proc) {
log_info('debug,router', "testing pattern=[{$pattern}] url=[{$url}]");
$params = self::_match($pattern, $url);
log_info('debug,router', "params:" . print_r($params, true));
// match
if ($params !== NULL) {
$request->setArray($params);
$request->set($proc_key, $proc);
log_info('debug,router', "routing rule matched! pattern=[{$pattern}] proc_path=[{$proc}]");
$result = array('proc' => $proc, 'params' => $params, 'pattern' => $pattern);
return $result;
}
}
}
log_warning('system,debug,router', "no routing rule is matched.");
} else {
log_warning('system,debug,router', "routing rule are not defined.");
}
return FALSE;
}
示例11: getCache
/**
* Get cache data
*
* @param Charcoal_String $key string name to identify cached data
* @param Charcoal_String $type_name_checked checks type(class/interface) if not NULL
*/
public function getCache($key, Charcoal_String $type_name_checked = NULL)
{
// Charcoal_ParamTrait::validateString( 1, $key );
// Charcoal_ParamTrait::validateString( 2, $type_name_checked, TRUE );
try {
$type_name_checked = us($type_name_checked);
$cached_data = Charcoal_Cache::get($key);
$type_check = $cached_data instanceof Charcoal_Object;
if (!$type_check) {
$actual_type = get_class($cached_data);
log_warning("system, debug, cache", "cache", "cache type mismatch: expected=[Charcoal_Object] actual=[{$actual_type}]");
return FALSE;
}
if ($cached_data !== FALSE && $type_name_checked !== NULL) {
$type_check = $cached_data instanceof $type_name_checked;
if (!$type_check) {
$actual_type = get_class($cached_data);
log_warning("system, debug, cache", "cache", "cache type mismatch: expected=[{$type_name_checked}] actual=[{$actual_type}]");
return FALSE;
}
}
return $cached_data;
} catch (Exception $ex) {
_catch($ex);
_throw(new Charcoal_EventContextException(__METHOD__ . '() failed.', $ex));
}
}
示例12: warning
/**
* Warning logging
*
* @param string $message
*/
public static function warning($message)
{
log_warning($message);
}
示例13: handle_comment
function handle_comment($comment)
{
global $OK_EXTRA_FUNCTIONS;
if (substr($comment[1], 0, 17) == 'EXTRA FUNCTIONS: ') {
$OK_EXTRA_FUNCTIONS = substr($comment[1], 17);
}
if (isset($GLOBALS['TODO'])) {
if (strpos($comment[1], 'TODO') !== false) {
log_warning('TODO comment found', $GLOBALS['i']);
}
if (strpos($comment[1], 'HACKHACK') !== false) {
log_warning('HACKHACK comment found', $GLOBALS['i']);
}
if (strpos($comment[1], 'FIXME') !== false) {
log_warning('FIXME comment found', $GLOBALS['i']);
}
}
}
示例14: processEvents
/**
* process events
*
* @param Charcoal_IEventContext $context
*
* @return int
*
* @throws Charcoal_BusinessException|Charcoal_RuntimeException
*/
public function processEvents($context)
{
$debug = $this->getSandbox()->isDebug() || $context->getProcedure()->isDebugMode();
if ($debug) {
log_debug('system,event', "processEvents start.");
}
// $procedure = $context->getProcedure();
// $request = $context->getRequest();
// $sequence = $context->getSequence();
// $response = $context->getResponse();
$max_event_loop = $this->max_event_loop;
$exit_code = 0;
try {
$queue = $this->queue;
$timer_all = Charcoal_Benchmark::start();
$loop_id = 0;
while (!$queue->isEmpty()) {
if ($debug) {
log_debug('system,event', "event queue(" . count($queue) . "): {$queue}");
}
// increment loop counter
$loop_id++;
// イベント一覧を優先度でソートする
$queue->sortByPriority();
/** @var Charcoal_IEvent $event */
$event = $queue->dequeue();
/** @var string $event_name */
$event_name = $event->getObjectName();
/** @var Charcoal_ObjectPath $event_id */
$event_id = $event->getObjectPath();
$delete_event = FALSE;
$context->setEvent($event);
// if this event loop exceeds [max_event_loop], thro exception
if ($loop_id > $max_event_loop) {
log_warning("system,event", "[loop:{$loop_id}/{$event_name}] aborting by overflow maximum loop count[{$max_event_loop}].", "task_manager");
log_warning("system,event", "[loop:{$loop_id}/{$event_name}] event queue=[{$queue}].", "task_manager");
_throw(new Charcoal_EventLoopCounterOverflowException($max_event_loop));
}
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}] event loop start.");
}
// タスク一覧を優先度でソートする
$key_priority = array();
foreach ($this->tasks as $key => $task) {
$key_priority[$key] = ui($task->getPriority());
}
$a_task_list = uv($this->tasks);
array_multisort($key_priority, SORT_DESC, $a_task_list);
$this->tasks = v($a_task_list);
// task list to remove on end of this loop
$remove_tasks = NULL;
// すべてのタスクにイベントをディスパッチする
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}] task list: [{$this->tasks}]");
}
foreach ($this->tasks as $task) {
$task_name = $task->getObjectName();
$task_id = $task->getObjectPath();
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is dispatching to task[{$task_name}].");
}
// イベントフィルタ
$process = FALSE;
$event_filters = $task->getEventFilters();
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] task event filter: " . $event_filters);
}
foreach ($event_filters as $filter) {
if ($event_id->getObjectPathString() == us($filter)) {
$process = TRUE;
break;
}
}
if (!$process) {
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is NOT found in task's event filters: [{$event_filters}]. Passing this task.");
}
continue;
}
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is found in task's event filters: [{$event_filters}].");
}
// task timer start
$timer_task = Charcoal_Benchmark::start();
$result = NULL;
try {
$result = $task->processEvent($context);
if ($debug) {
log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] returned from processEvent with result:" . print_r($result, true));
}
} catch (Charcoal_BusinessException $e) {
//.........这里部分代码省略.........
示例15: delete_user
/**
* @param Page $page
* @param bool $with_images
* @param bool $with_comments
*/
private function delete_user(Page $page, $with_images = false, $with_comments = false)
{
global $user, $config, $database;
$page->set_title("Error");
$page->set_heading("Error");
$page->add_block(new NavBlock());
if (!$user->can("delete_user")) {
$page->add_block(new Block("Not Admin", "Only admins can delete accounts"));
} else {
if (!isset($_POST['id']) || !is_numeric($_POST['id'])) {
$page->add_block(new Block("No ID Specified", "You need to specify the account number to edit"));
} else {
log_warning("user", "Deleting user #{$_POST['id']}");
if ($with_images) {
log_warning("user", "Deleting user #{$_POST['id']}'s uploads");
$rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", array("owner_id" => $_POST['id']));
foreach ($rows as $key => $value) {
$image = Image::by_id($value['id']);
if ($image) {
send_event(new ImageDeletionEvent($image));
}
}
} else {
$database->Execute("UPDATE images SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id']));
}
if ($with_comments) {
log_warning("user", "Deleting user #{$_POST['id']}'s comments");
$database->execute("DELETE FROM comments WHERE owner_id = :owner_id", array("owner_id" => $_POST['id']));
} else {
$database->Execute("UPDATE comments SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id']));
}
send_event(new UserDeletionEvent($_POST['id']));
$database->execute("DELETE FROM users WHERE id = :id", array("id" => $_POST['id']));
$page->set_mode("redirect");
$page->set_redirect(make_link("post/list"));
}
}
}