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


PHP Logger::getLogger方法代码示例

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


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

示例1: __call

 public function __call($method, $args)
 {
     // If observer enabled
     if (!$this->Config || $this->Config->GetFieldByName("IsEnabled")->Value == 0) {
         return;
     }
     $enabled = $this->Config->GetFieldByName("{$method}Notify");
     if (!$enabled || $enabled->Value == 0) {
         return;
     }
     $DB = \Scalr::getDb();
     // Event name
     $name = substr($method, 2);
     // Event message
     $message = $DB->GetOne("SELECT message FROM events WHERE event_id = ? LIMIT 1", array($args[0]->GetEventID()));
     $farm_name = $DB->GetOne("SELECT name FROM farms WHERE id=? LIMIT 1", array($args[0]->GetFarmID()));
     // Set subject
     if (!$farm_name) {
         $this->Mailer->setSubject("{$name} event notification (FarmID: {$args[0]->GetFarmID()})");
     } else {
         $this->Mailer->setSubject("{$name} event notification (FarmID: {$args[0]->GetFarmID()} FarmName: {$farm_name})");
     }
     // Set body
     $this->Mailer->setMessage($message);
     // Send mail
     try {
         $res = $this->Mailer->send();
     } catch (\Exception $e) {
         $res = false;
     }
     if (!$res) {
         Logger::getLogger(__CLASS__)->info("Mail sent to '{$this->Config->GetFieldByName("EventMailTo")->Value}'. Result: {$res}");
     }
 }
开发者ID:recipe,项目名称:scalr,代码行数:34,代码来源:class.MailEventObserver.php

示例2: getLogger

 /**
  * Get Logger instance. Creates if not already created.
  *
  * @return Logger
  */
 protected function getLogger()
 {
     if (is_null($this->logger)) {
         $this->logger = Logger::getLogger('core.SchedulerService');
     }
     return $this->logger;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:12,代码来源:SchedulerService.php

示例3: getLoggerInstance

 /**
  * Get Logger instance. Creates if not already created.
  *
  * @return Logger
  */
 protected function getLoggerInstance()
 {
     if (is_null($this->logger)) {
         $this->logger = Logger::getLogger('leave.undeleteLeaveTypeAction');
     }
     return $this->logger;
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:12,代码来源:undeleteLeaveTypeAction.class.php

示例4: execute

 public function execute($request)
 {
     if ($request->isMethod(sfWebRequest::POST)) {
         $username = $request->getParameter('txtUsername');
         $password = $request->getParameter('txtPassword');
         $additionalData = array('timeZoneOffset' => $request->getParameter('hdnUserTimeZoneOffset', 0));
         try {
             $success = $this->getAuthenticationService()->setCredentials($username, $password, $additionalData);
             if ($success) {
                 $this->getLoginService()->addLogin();
                 $paramString = $this->_getParameterString($request, true);
                 //$this->redirect('oauth/authorize'. $paramString);
                 $url = url_for('oauth/authorize') . $paramString;
                 $logger = Logger::getLogger('login');
                 $loggedInUserId = $this->getAuthenticationService()->getLoggedInUserId();
                 $loggedInUser = $this->getSystemUserService()->getSystemUser($loggedInUserId);
                 $logger->info($loggedInUserId . ', ' . $loggedInUser->getUserName() . ', ' . $_SERVER['REMOTE_ADDR']);
                 $this->redirect($url);
             } else {
                 $paramString = $this->_getParameterString($request);
                 $this->getUser()->setFlash('message', __('Invalid credentials'), true);
                 $this->redirect('oauth/login' . $paramString);
             }
         } catch (AuthenticationServiceException $e) {
             $this->getUser()->setFlash('message', $e->getMessage(), true);
             $paramString = $this->_getParameterString($request);
             $this->redirect('oauth/login' . $paramString);
         }
     }
     return sfView::NONE;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:31,代码来源:validateCredentialsAction.class.php

示例5: removeNodeFromChefServer

 private function removeNodeFromChefServer(DBServer $dbServer, $config, $nodeName)
 {
     $chefSettings = $dbServer->GetFarmRoleObject()->getChefSettings();
     $chefServerInfo = $this->db->GetRow("SELECT * FROM services_chef_servers WHERE id=?", array($chefSettings[self::ROLE_CHEF_SERVER_ID]));
     $chefServerInfo['auth_key'] = trim($this->getCrypto()->decrypt($chefServerInfo['auth_key'], $this->cryptoKey));
     $chefClient = Scalr_Service_Chef_Client::getChef($config->serverUrl, $chefServerInfo['username'], trim($chefServerInfo['auth_key']));
     try {
         $status = $chefClient->removeNode($nodeName);
         if ($status) {
             Logger::getLogger(LOG_CATEGORY::FARM)->warn(new FarmLogMessage($dbServer->farmId, sprintf("Chef node '%s' removed from chef server", $nodeName)));
         } else {
             Logger::getLogger(LOG_CATEGORY::FARM)->error(new FarmLogMessage($dbServer->farmId, sprintf("Unable to remove chef node '%s' from chef server: %s", $nodeName, $status)));
         }
     } catch (Exception $e) {
         Logger::getLogger(LOG_CATEGORY::FARM)->error(new FarmLogMessage($dbServer->farmId, sprintf("Unable to remove chef node '%s' from chef server: %s", $nodeName, $e->getMessage())));
     }
     try {
         $status2 = $chefClient->removeClient($nodeName);
         if ($status2) {
             Logger::getLogger(LOG_CATEGORY::FARM)->warn(new FarmLogMessage($dbServer->farmId, sprintf("Chef client '%s' removed from chef server", $nodeName)));
         } else {
             Logger::getLogger(LOG_CATEGORY::FARM)->error(new FarmLogMessage($dbServer->farmId, sprintf("Unable to remove chef client '%s' from chef server: %s", $nodeName, $status2)));
         }
     } catch (Exception $e) {
         Logger::getLogger(LOG_CATEGORY::FARM)->error(new FarmLogMessage($dbServer->farmId, sprintf("Unable to remove chef node '%s' from chef server: %s", $nodeName, $e->getMessage())));
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:27,代码来源:Chef.php

示例6: __construct

 /**
  * @param $config
  * @key string [name]
  * @key string [key]
  * @key array [items]
  */
 function __construct($config)
 {
     $this->logger = Logger::getLogger(__CLASS__);
     $this->initialConfig = $config;
     $this->shm = new Scalr_System_Ipc_Shm($config);
     $key = $this->shm->key + 8;
     $this->logger->debug(sprintf("Get semaphore (key: 0x%08x)", $key));
     $this->sem = sem_get($key, 1, 0666, true);
     if (!$this->sem) {
         throw new Scalr_System_Ipc_Exception("Cannot sem_get (key: {$key})");
     }
     if (!sem_acquire($this->sem)) {
         throw new Scalr_System_Ipc_Exception("Cannot acquire semaphore");
     }
     try {
         $meta = $this->getMeta();
         if ($meta === null) {
             $this->clear0();
         }
         sem_release($this->sem);
     } catch (Exception $e) {
         sem_release($this->sem);
         throw $e;
     }
     if ($config["items"]) {
         foreach ($config["items"] as $item) {
             $this->add($item);
         }
     }
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:36,代码来源:ShmSet.php

示例7: handle

 public function handle(EventMessage $event)
 {
     if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
         if ($event->getSubEvent() == 'Start') {
             switch ($pid = pcntl_fork()) {
                 case 0:
                     $logger = \Logger::getLogger(__CLASS__);
                     $this->_client = new ClientImpl($this->_pamiOptions);
                     $this->_client->open();
                     $agi = new \PAMI\AsyncAgi\AsyncClientImpl(array('pamiClient' => $this->_client, 'asyncAgiEvent' => $event));
                     $app = new MyPAGIApplication(array('pagiClient' => $agi));
                     $app->init();
                     $app->run();
                     //$agi->indicateProgress();
                     //$agi->answer();
                     //$agi->streamFile('welcome');
                     //$agi->playCustomTones(array("425/50","0/50"));
                     //sleep(5);
                     //$agi->indicateCongestion(10);
                     //$agi->hangup();
                     $this->_client->close();
                     echo "Application finished\n";
                     exit(0);
                     break;
                 case -1:
                     echo "Could not fork application\n";
                     break;
                 default:
                     echo "Forked Application\n";
                     break;
             }
         }
     }
 }
开发者ID:bit0rez,项目名称:PAMI,代码行数:34,代码来源:example.php

示例8: using

 /**
  * @static
  * @param mixed $resource A resource that needs to be closed, for example a mysql connection
  * @param callable $callable (resource) => T Callable method that accepts $resource as parameter
  * @param string $close [Optional] Name of close method on $resource
  * @return mixed product of $callable (can be null)
  * @throws \Exception If resource is null or if there is a problem with the callable
  */
 public static function using($resource, $callable, $close = 'close')
 {
     if (!$resource) {
         throw new \InvalidArgumentException('Cannot loan a null resource');
     }
     $logger = \Logger::getLogger(__CLASS__);
     $problem = null;
     $result = null;
     try {
         $result = $callable($resource);
         $logger->debug('Successfully executed callable on resource');
     } catch (\Exception $e) {
         $logger->warn('Problem encountered using resource', $e);
         $problem = $e;
     }
     try {
         $resource->{$close}();
         $logger->debug('Successfully closed resource');
     } catch (\Exception $e) {
         $logger->warn('Problem encountered closing resource', $e);
         if ($problem) {
             $problem = new CompoundException($e->getMessage(), $e->getCode(), $problem);
         } else {
             // PHP has no built in support for re-throwing, so we explicitly do so
             throw $e;
         }
     }
     if ($problem) {
         throw $problem;
     }
     return $result;
 }
开发者ID:martinsv,项目名称:bart,代码行数:40,代码来源:Loan.php

示例9: getLogger

 /**
  * Get Logger instance
  * @return Logger
  */
 public function getLogger()
 {
     if (empty($this->logger)) {
         $this->logger = Logger::getLogger('leave.leavemailer');
     }
     return $this->logger;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:11,代码来源:LeaveEmailProcessor.php

示例10: __construct

 /**
  * @param $config
  * @key string $jobDir
  * @key string $clsSuffix
  * @key string $clsNamespace
  * @key bool $oldSyntax (default true)
  * TODO: add $getopt key
  * TODO: support new syntax: php -q cron.php [options] task 
  */
 function __construct($config)
 {
     foreach ($config as $k => $v) {
         $this->{$k} = $v;
     }
     $this->logger = Logger::getLogger(__CLASS__);
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:16,代码来源:Launcher.php

示例11: __construct

 function __construct($bridge, $version)
 {
     $this->bridge = $bridge;
     $this->version = $version;
     $this->defaultCharset = 'utf-8';
     $this->logger = Logger::getLogger(__CLASS__);
 }
开发者ID:RobertWang,项目名称:sabre-zarafa,代码行数:7,代码来源:VCardProducer.php

示例12: __construct

 /**
  * Constructor
  * @ignore 
  */
 function __construct()
 {
     $this->Logger = Logger::getLogger('SignalHandler');
     if (!function_exists("pcntl_signal")) {
         self::RaiseError("Function pcntl_signal() not found. PCNTL must be enabled in PHP.", E_ERROR);
     }
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:11,代码来源:class.SignalHandler.php

示例13: getUserRoleManager

 public function getUserRoleManager()
 {
     $logger = Logger::getLogger('core.UserRoleManagerService');
     $class = $this->getUserRoleManagerClassName();
     $manager = null;
     if (class_exists($class)) {
         try {
             $manager = new $class();
         } catch (Exception $e) {
             throw new ServiceException('Exception when initializing user role manager:' . $e->getMessage());
         }
     } else {
         throw new ServiceException('User Role Manager class ' . $class . ' not found.');
     }
     if (!$manager instanceof AbstractUserRoleManager) {
         throw new ServiceException('User Role Manager class ' . $class . ' is not a subclass of AbstractUserRoleManager');
     }
     // Set System User object in manager
     $userId = $this->getAuthenticationService()->getLoggedInUserId();
     $systemUser = $this->getSystemUserService()->getSystemUser($userId);
     if ($systemUser instanceof SystemUser) {
         $manager->setUser($systemUser);
     } else {
         if ($logger->isInfoEnabled()) {
             $logger->info('No logged in system user when creating UserRoleManager');
         }
     }
     return $manager;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:29,代码来源:UserRoleManagerService.php

示例14: __construct

 public function __construct($fieldsAndValues)
 {
     $logger = Logger::getLogger('NounRoot.__construct');
     $logger->debug("new NounRoot");
     parent::__construct($fieldsAndValues);
     $logger->debug("new NounRoot, apr�s parent::__construct");
     $this->number = $fieldsAndValues['number'];
     if ($this->number == NULL || $this->number == '') {
         $this->number = 's';
     }
     $this->cf = $fieldsAndValues['cf'];
     if ($this->cf != NULL && $this->cf != '') {
         $this->cfs = explode(' ', $this->cf);
     }
     $this->dialect = $fieldsAndValues['dialect'];
     $this->source = $fieldsAndValues['source'];
     if ($this->source == NULL || $this->source == '') {
         $this->source = 'A2';
     }
     $this->sources = explode(' ', $this->source);
     // Racine de composition pour les racines duelles et plurielles
     $this->compositionRoot = $fieldsAndValues['compositionRoot'];
     $this->morphemeID = self::make_id($fieldsAndValues);
     $logger->debug("new NounRoot, exit");
 }
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:25,代码来源:NounRoot.php

示例15: Save

 public function Save(Location $location)
 {
     try {
         $SQL = self::$INSERT;
         if ($location->getSeq() != null && $location->getSeq() != "" && $location->getSeq() > 0) {
             $SQL = self::$UPDATE;
         }
         $conn = self::$db->getConnection();
         $stmt = $conn->prepare($SQL);
         $stmt->bindValue(':name', $location->getLocationName());
         $stmt->bindValue(':locationfolder', $location->getLocationFolder());
         $stmt->bindValue(':details', $location->getLocationDetails());
         $isPrivate = 0;
         if ($location->getIsPrivate() == true || $location->getIsPrivate() == 1) {
             $isPrivate = 1;
         }
         $stmt->bindValue(':hasdirectory', $location->getHasDirectory());
         $stmt->bindValue(':isprivate', $isPrivate);
         if ($SQL == self::$UPDATE) {
             $stmt->bindValue(':locationSeq', $location->getSeq());
         }
         $stmt->execute();
         $error = $stmt->errorInfo();
         if ($error[2] != "") {
             throw new Exception($error[2]);
         }
     } catch (Exception $e) {
         $logger = Logger::getLogger($ConstantsArray["logger"]);
         $logger->error("Error During Save Location : - " . $e->getMessage());
     }
     //I will be put code here for throw exception and show on the screen
 }
开发者ID:munishsethi777,项目名称:eliveui,代码行数:32,代码来源:LocationDataStore.php


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