当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::warn方法代码示例

本文整理汇总了PHP中Logger::warn方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::warn方法的具体用法?PHP Logger::warn怎么用?PHP Logger::warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger::warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: warn

 /**
  * @param string|\Exception $msg
  * @param array $context
  * @throws \RuntimeException
  */
 public static function warn($msg, array $context = array())
 {
     if (empty(static::$instance)) {
         throw new \RuntimeException('Logger instance not added to proxy yet');
     }
     static::$instance->warn($msg, $context);
 }
开发者ID:zalora,项目名称:punyan,代码行数:12,代码来源:ZLog.php

示例2: setPageName

 public function setPageName($pageName)
 {
     if (strlen($pageName) > 64) {
         $this->log->warn('The following pagename exceeds 64 characters: ' . $pageName);
     }
     $this->pageName = $pageName;
 }
开发者ID:Waryway,项目名称:Website,代码行数:7,代码来源:Page.php

示例3: getFieldData

 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $values = $field_change->value;
     $files_infos = array();
     if ($this->isFieldChangeEmpty($values)) {
         $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': field value is empty.');
         return $files_infos;
     }
     foreach ($values as $value) {
         try {
             $attributes = $value->attributes();
             $file_id = (string) $attributes['ref'];
             $file = $this->files_importer->getFileXML($file_id);
             if (!$this->files_importer->fileIsAlreadyImported($file_id)) {
                 $files_infos[] = $this->getFileInfoForAttachment($file);
                 $this->files_importer->markAsImported($file_id);
             }
         } catch (Tracker_Artifact_XMLImport_Exception_FileNotFoundException $exception) {
             $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': ' . $exception->getMessage());
         }
     }
     if ($this->itCannotImportAnyFiles($values, $files_infos)) {
         throw new Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException();
     }
     return $files_infos;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:34,代码来源:XMLImportFieldStrategyAttachment.class.php

示例4: sendNotice

 /**
  * Sends a notice about deprecated use of a function, view, etc.
  *
  * @param string $msg             Message to log
  * @param string $dep_version     Human-readable *release* version: 1.7, 1.8, ...
  * @param int    $backtrace_level How many levels back to display the backtrace.
  *                                Useful if calling from functions that are called
  *                                from other places (like elgg_view()). Set to -1
  *                                for a full backtrace.
  * @return bool
  */
 function sendNotice($msg, $dep_version, $backtrace_level = 1)
 {
     if (!$dep_version) {
         return false;
     }
     $elgg_version = elgg_get_version(true);
     $elgg_version_arr = explode('.', $elgg_version);
     $elgg_major_version = (int) $elgg_version_arr[0];
     $elgg_minor_version = (int) $elgg_version_arr[1];
     $dep_version_arr = explode('.', (string) $dep_version);
     $dep_major_version = (int) $dep_version_arr[0];
     $dep_minor_version = (int) $dep_version_arr[1];
     $msg = "Deprecated in {$dep_major_version}.{$dep_minor_version}: {$msg} Called from ";
     // Get a file and line number for the log. Skip over the function that
     // sent this notice and see who called the deprecated function itself.
     $stack = array();
     $backtrace = debug_backtrace();
     // never show this call.
     array_shift($backtrace);
     $i = count($backtrace);
     foreach ($backtrace as $trace) {
         $stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
         $i--;
         if ($backtrace_level > 0) {
             if ($backtrace_level <= 1) {
                 break;
             }
             $backtrace_level--;
         }
     }
     $msg .= implode("<br /> -> ", $stack);
     $this->logger->warn($msg);
     return true;
 }
开发者ID:ibou77,项目名称:elgg,代码行数:45,代码来源:DeprecationService.php

示例5: sendNotice

 /**
  * Sends a notice about deprecated use of a function, view, etc.
  *
  * @param string $msg             Message to log
  * @param string $dep_version     Human-readable *release* version: 1.7, 1.8, ...
  * @param int    $backtrace_level How many levels back to display the backtrace.
  *                                Useful if calling from functions that are called
  *                                from other places (like elgg_view()). Set to -1
  *                                for a full backtrace.
  * @return bool
  */
 function sendNotice($msg, $dep_version, $backtrace_level = 1)
 {
     $msg = "Deprecated in {$dep_version}: {$msg} Called from ";
     // Get a file and line number for the log. Skip over the function that
     // sent this notice and see who called the deprecated function itself.
     $stack = array();
     $backtrace = debug_backtrace();
     // never show this call.
     array_shift($backtrace);
     $i = count($backtrace);
     foreach ($backtrace as $trace) {
         if (empty($trace['file'])) {
             // file/line not set for Closures
             $stack[] = "[#{$i}] unknown";
         } else {
             $stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
         }
         $i--;
         if ($backtrace_level > 0) {
             if ($backtrace_level <= 1) {
                 break;
             }
             $backtrace_level--;
         }
     }
     $msg .= implode("<br /> -> ", $stack);
     $this->logger->warn($msg);
     return true;
 }
开发者ID:elgg,项目名称:elgg,代码行数:40,代码来源:DeprecationService.php

示例6: updateWithUserId

 public function updateWithUserId($user_id)
 {
     $user = $this->user_manager->getUserById($user_id);
     if ($user && $user->isAlive()) {
         $this->updateWithUser($user);
     } else {
         $this->logger->warn('Do not write LDAP info about non existant or suspended users ' . $user_id);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:LDAP_UserWrite.class.php

示例7: importLanguage

 private function importLanguage(Project $project, $language)
 {
     $this->logger->info("Set language to {$language} for {$project->getUnixName()}");
     try {
         $this->language_manager->saveLanguageOption($project, $language);
     } catch (Mediawiki_UnsupportedLanguageException $e) {
         $this->logger->warn("Could not set up the language for {$project->getUnixName()} mediawiki, {$language} is not sopported.");
     }
 }
开发者ID:AdriandeCita,项目名称:tuleap,代码行数:9,代码来源:MediaWikiXMLImporter.class.php

示例8: cleanUpGitoliteAdminWorkingCopy

 public function cleanUpGitoliteAdminWorkingCopy()
 {
     if ($this->dao->isGitGcEnabled()) {
         $this->logger->info('Running git gc on gitolite admin working copy.');
         $this->execGitGcAsAppAdm();
     } else {
         $this->logger->warn('Cannot run git gc on gitolite admin working copy. ' . 'Please run as root: /usr/share/codendi/src/utils/php-launcher.sh ' . '/usr/share/codendi/plugins/git/bin/gl-admin-housekeeping.php');
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:GitoliteHousekeepingGitGc.class.php

示例9: push

 public static function push($msg, $code = self::GENERIC_ERROR, $severity = self::SEVERITY_ERROR)
 {
     self::init();
     self::$errors->enqueue(new Error($msg, $code, $severity));
     if ($severity == self::SEVERITY_ERROR) {
         self::$logger->error($msg);
     } else {
         self::$logger->warn($msg);
     }
 }
开发者ID:Eygle,项目名称:INeedU,代码行数:10,代码来源:ErrorManager.class.php

示例10: appendValidValue

 private function appendValidValue(array &$data, Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     try {
         $submitted_value = $this->getFieldData($field, $field_change);
         if ($field->validateField($this->createFakeArtifact(), $submitted_value)) {
             $data[$field->getId()] = $submitted_value;
         } else {
             $this->logger->warn("Skipped invalid value " . (string) $submitted_value . " for field " . $field->getName());
         }
     } catch (Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException $exception) {
         $this->logger->warn("Skipped invalid value for field " . $field->getName() . ': ' . $exception->getMessage());
     } catch (Tracker_Artifact_XMLImport_Exception_ArtifactLinksAreIgnoredException $exception) {
         return;
     }
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:15,代码来源:ArtifactFieldsDataBuilder.class.php

示例11: getConnection

 /**
  * @static
  * @return Zend_Db_Adapter_Abstract
  */
 public static function getConnection()
 {
     $charset = "UTF8";
     // explicit set charset for connection (to the adapter)
     $config = Pimcore_Config::getSystemConfig()->toArray();
     $config["database"]["params"]["charset"] = $charset;
     $db = Zend_Db::factory($config["database"]["adapter"], $config["database"]["params"]);
     $db->query("SET NAMES " . $charset);
     // try to set innodb as default storage-engine
     try {
         $db->query("SET storage_engine=InnoDB;");
     } catch (Exception $e) {
         Logger::warn($e);
     }
     // enable the db-profiler if the devmode is on and there is no custom profiler set (eg. in system.xml)
     if (PIMCORE_DEVMODE && !$db->getProfiler()->getEnabled()) {
         $profiler = new Pimcore_Db_Profiler('All DB Queries');
         $profiler->setEnabled(true);
         $db->setProfiler($profiler);
     }
     // put the connection into a wrapper to handle connection timeouts, ...
     $db = new Pimcore_Resource_Wrapper($db);
     Logger::debug("Successfully established connection to MySQL-Server");
     return $db;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:29,代码来源:Mysql.php

示例12: send

 /**
  * @param string $remoteQuery Gerrity query
  * @param boolean $expectResponse If a JSON response is expected
  * @return null|ApiResult
  * @throws GerritException
  */
 private function send($remoteQuery, $expectResponse = true)
 {
     try {
         $this->logger->debug("Sending remote command to gerrit: {$remoteQuery}");
         $gerritResponseArray = $this->ssh->exec($remoteQuery);
         if (!$expectResponse) {
             return;
         }
         $stats = JSON::decode(array_pop($gerritResponseArray));
         if ($stats['type'] == 'error') {
             throw new GerritException($stats['message']);
         }
         $records = array();
         foreach ($gerritResponseArray as $json) {
             $records[] = JSON::decode($json);
         }
         return new ApiResult($stats, $records);
     } catch (CommandException $e) {
         $this->logger->warn('Gerrit query failed', $e);
         throw new GerritException('Query to gerrit failed', 0, $e);
     } catch (JSONParseException $e) {
         $this->logger->warn('Gerrit query returned bad json', $e);
         throw new GerritException('Gerrit query returned bad json', 0, $e);
     }
 }
开发者ID:martinsv,项目名称:bart,代码行数:31,代码来源:Api.php

示例13: exec

 /**
  * @param $cmd
  * @param null $outputFile
  * @param null $timeout
  * @return string
  */
 public static function exec($cmd, $outputFile = null, $timeout = null)
 {
     if ($timeout && self::getTimeoutBinary()) {
         // check if --kill-after flag is supported in timeout
         $killafter = "";
         $out = self::exec(self::getTimeoutBinary() . " --help");
         if (strpos($out, "--kill-after")) {
             $killafter = " -k 1m";
         }
         $cmd = self::getTimeoutBinary() . $killafter . " " . $timeout . "s " . $cmd;
     } elseif ($timeout) {
         \Logger::warn("timeout binary not found, executing command without timeout");
     }
     if ($outputFile) {
         $cmd = $cmd . " > " . $outputFile . " 2>&1";
     } else {
         // send stderr to /dev/null otherwise this goes to the apache error log and can fill it up pretty quickly
         if (self::getSystemEnvironment() != 'windows') {
             $cmd .= " 2> /dev/null";
         }
     }
     \Logger::debug("Executing command `" . $cmd . "` on the current shell");
     $return = shell_exec($cmd);
     return $return;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:31,代码来源:Console.php

示例14: dispatch

 /**
  * Framework entry point
  *
  * @return void.
  */
 public function dispatch()
 {
     $request = new HTTPRequest();
     $response = new HTTPResponse();
     try {
         $configurator = $this->manager->getConfigurator();
         Registry::put($configurator, '__configurator');
         Registry::put($logger = new Logger($configurator), '__logger');
         $ap = $configurator->getApplicationPath();
         // application path
         $an = $configurator->getApplicationName();
         // application name
         $logger->debug('[Medick] >> version: ' . Medick::getVersion() . ' ready for ' . $an);
         $logger->debug('[Medick] >> Application path ' . $ap);
         $routes_path = $ap . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . $an . '.routes.php';
         include_once $routes_path;
         // load routes
         $logger->debug('[Medick] >> Config File: ' . str_replace($ap, '${' . $an . '}', $configurator->getConfigFile()));
         $logger->debug('[Medick] >> Routes loaded from: ' . str_replace($ap, '${' . $an . '}', $routes_path));
         ActionControllerRouting::recognize($request)->process($request, $response)->dump();
     } catch (Exception $ex) {
         ActionController::process_with_exception($request, $response, $ex)->dump();
         $logger->warn($ex->getMessage());
     }
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:30,代码来源:Dispatcher.php

示例15: Nuevo

 public static function Nuevo($request)
 {
     try {
         self::ProblemaValido($request);
     } catch (InvalidArgumentException $e) {
         Logger::warn("imposible crear nuevo problema:" . $e->getMessage());
         return array("result" => "error", "reason" => $e->getMessage());
     }
     $usuarioActual = c_sesion::usuarioActual();
     if (!SUCCESS($usuarioActual)) {
         Logger::error("no hay permiso para crear nuevo problema");
         return array("result" => "error", "reason" => "No tienes permiso de hacer esto.");
     }
     $sql = "insert into Problema (titulo, problema, tiempoLimite, usuario_redactor) values (?,?,?,?)";
     $inputarray = array($request["titulo"], $request["problema"], $request["tiempoLimite"], $usuarioActual["userID"]);
     global $db;
     $res = $db->Execute($sql, $inputarray);
     if ($res === false) {
         Logger::error("TEDDY:" . $db->ErrorNo() . " " . $db->ErrorMsg());
         return array("result" => "error", "reason" => "Error interno.");
     }
     $id = $db->Insert_ID();
     if (!file_exists(PATH_TO_CASOS)) {
         Logger::error("TEDDY: " . PATH_TO_CASOS . " no existe");
         return array("result" => "error", "reason" => "Error interno.");
     }
     file_put_contents(PATH_TO_CASOS . "/" . $id . ".in", $request["entrada"]);
     file_put_contents(PATH_TO_CASOS . "/" . $id . ".out", $request["salida"]);
     Logger::info("Nuevo problema creado. ProbID: " . $id . " Titulo: " . $request["titulo"]);
     return array("result" => "ok", "probID" => $id);
 }
开发者ID:EdgarVaguencia,项目名称:teddy-online-judge,代码行数:31,代码来源:c_problema.php


注:本文中的Logger::warn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。