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


PHP Logger::debug方法代码示例

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


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

示例1: fail

 /**
  * Set the hook as failed w/ the given message
  *
  * @param   string  $message    Error message or error format string
  * @param   mixed   ...$arg     Format string argument
  */
 private function fail($message)
 {
     $args = array_slice(func_get_args(), 1);
     $lastError = vsprintf($message, $args);
     Logger::debug($lastError);
     $this->lastError = $lastError;
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:13,代码来源:TicketHook.php

示例2: setFilter

 /**
  * Set the filter and render it internally.
  *
  * @param  Filter $filter
  *
  * @return $this
  *
  * @throws ProgrammingError
  */
 public function setFilter(Filter $filter)
 {
     $this->filter = $filter;
     $this->query = $this->renderFilter($this->filter);
     Logger::debug('Rendered elasticsearch filter: %s', json_encode($this->query));
     return $this;
 }
开发者ID:Icinga,项目名称:icingaweb2-module-elasticsearch,代码行数:16,代码来源:FilterRenderer.php

示例3: write

 /**
  * Append the given log entry or nested inspection
  *
  * @throws  ProgrammingError            When called after erroring
  *
  * @param $entry    string|Inspection   A log entry or nested inspection
  */
 public function write($entry)
 {
     if (isset($this->error)) {
         throw new ProgrammingError('Inspection object used after error');
     }
     if ($entry instanceof Inspection) {
         $this->log[$entry->description] = $entry->toArray();
     } else {
         Logger::debug($entry);
         $this->log[] = $entry;
     }
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:19,代码来源:Inspection.php

示例4: resolveMacro

 /**
  * Resolve a macro based on the given object
  *
  * @param   string                      $macro      The macro to resolve
  * @param   MonitoredObject|stdClass    $object     The object used to resolve the macro
  *
  * @return  string                                  The new value or the macro if it cannot be resolved
  */
 public static function resolveMacro($macro, $object)
 {
     if (isset(self::$icingaMacros[$macro]) && isset($object->{self::$icingaMacros[$macro]})) {
         return $object->{self::$icingaMacros[$macro]};
     }
     try {
         $value = $object->{$macro};
     } catch (Exception $e) {
         $value = null;
         Logger::debug('Unable to resolve macro "%s". An error occured: %s', $macro, $e);
     }
     return $value !== null ? $value : $macro;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:21,代码来源:Macro.php

示例5: createItem

 /**
  * Create and return a new navigation item for the given configuration
  *
  * @param   string              $name
  * @param   array|ConfigObject  $properties
  *
  * @return  NavigationItem
  *
  * @throws  InvalidArgumentException    If the $properties argument is neither an array nor a ConfigObject
  */
 public function createItem($name, $properties)
 {
     if ($properties instanceof ConfigObject) {
         $properties = $properties->toArray();
     } elseif (!is_array($properties)) {
         throw new InvalidArgumentException('Argument $properties must be of type array or ConfigObject');
     }
     $itemType = isset($properties['type']) ? String::cname($properties['type'], '-') : 'NavigationItem';
     if (!empty(static::$types) && isset(static::$types[$itemType])) {
         return new static::$types[$itemType]($name, $properties);
     }
     $item = null;
     foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
         $classPath = 'Icinga\\Module\\' . ucfirst($module->getName()) . '\\' . static::NAVIGATION_NS . '\\' . $itemType;
         if (class_exists($classPath)) {
             $item = new $classPath($name, $properties);
             break;
         }
     }
     if ($item === null) {
         $classPath = 'Icinga\\' . static::NAVIGATION_NS . '\\' . $itemType;
         if (class_exists($classPath)) {
             $item = new $classPath($name, $properties);
         }
     }
     if ($item === null) {
         Logger::debug('Failed to find custom navigation item class %s for item %s. Using base class NavigationItem now', $itemType, $name);
         $item = new NavigationItem($name, $properties);
         static::$types[$itemType] = 'Icinga\\Web\\Navigation\\NavigationItem';
     } elseif (!$item instanceof NavigationItem) {
         throw new ProgrammingError('Class %s must inherit from NavigationItem', $classPath);
     } else {
         static::$types[$itemType] = $classPath;
     }
     return $item;
 }
开发者ID:AndHab,项目名称:icingaweb2,代码行数:46,代码来源:Navigation.php

示例6: sendCommand

 protected function sendCommand(IcingaApiCommand $command)
 {
     Logger::debug('Sending Icinga command "%s" to the API "%s:%u"', $command->getEndpoint(), $this->getHost(), $this->getPort());
     $response = RestRequest::post($this->getUriFor($command->getEndpoint()))->authenticateWith($this->getUsername(), $this->getPassword())->sendJson()->noStrictSsl()->setPayload($command->getData())->send();
     if (isset($response['error'])) {
         throw new CommandTransportException('Can\'t send external Icinga command: %u %s', $response['error'], $response['status']);
     }
     $result = array_pop($response['results']);
     if ($result['code'] < 200 || $result['code'] >= 300) {
         throw new CommandTransportException('Can\'t send external Icinga command: %u %s', $result['code'], $result['status']);
     }
     if ($command->hasNext()) {
         $this->sendCommand($command->getNext());
     }
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:15,代码来源:ApiCommandTransport.php

示例7: send

 /**
  * Write the command to the Icinga command file on the remote host
  *
  * @param   IcingaCommand   $command
  * @param   int|null        $now
  *
  * @throws  ConfigurationError
  * @throws  TransportException
  */
 public function send(IcingaCommand $command, $now = null)
 {
     if (!isset($this->path)) {
         throw new ConfigurationError('Can\'t send external Icinga Command. Path to the remote command file is missing');
     }
     if (!isset($this->host)) {
         throw new ConfigurationError('Can\'t send external Icinga Command. Remote host is missing');
     }
     $commandString = $this->renderer->render($command, $now);
     Logger::debug('Sending external Icinga command "%s" to the remote command file "%s:%u%s"', $commandString, $this->host, $this->port, $this->path);
     $ssh = sprintf('ssh -o BatchMode=yes -p %u', $this->port);
     // -o BatchMode=yes for disabling interactive authentication methods
     if (isset($this->user)) {
         $ssh .= sprintf(' -l %s', escapeshellarg($this->user));
     }
     if (isset($this->privateKey)) {
         $ssh .= sprintf(' -o StrictHostKeyChecking=no -i %s', escapeshellarg($this->privateKey));
     }
     $ssh .= sprintf(' %s "echo %s > %s" 2>&1', escapeshellarg($this->host), escapeshellarg($commandString), escapeshellarg($this->path));
     exec($ssh, $output, $status);
     if ($status !== 0) {
         throw new TransportException('Can\'t send external Icinga command: %s', implode(' ', $output));
     }
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:33,代码来源:RemoteCommandFile.php

示例8: order

 /**
  * Add a sort rule for this query
  *
  * If called without a specific column, the repository's defaul sort rules will be applied.
  * This notifies the repository about each column being required as filter column.
  *
  * @param   string  $field          The name of the column by which to sort the query's result
  * @param   string  $direction      The direction to use when sorting (asc or desc, default is asc)
  * @param   bool    $ignoreDefault  Whether to ignore any default sort rules if $field is given
  *
  * @return  $this
  */
 public function order($field = null, $direction = null, $ignoreDefault = false)
 {
     $sortRules = $this->getSortRules();
     if ($field === null) {
         // Use first available sort rule as default
         if (empty($sortRules)) {
             // Return early in case of no sort defaults and no given $field
             return $this;
         }
         $sortColumns = reset($sortRules);
         if (!array_key_exists('columns', $sortColumns)) {
             $sortColumns['columns'] = array(key($sortRules));
         }
         if ($direction !== null || !array_key_exists('order', $sortColumns)) {
             $sortColumns['order'] = $direction ?: static::SORT_ASC;
         }
     } else {
         $alias = $this->repository->reassembleQueryColumnAlias($this->target, $field) ?: $field;
         if (!$ignoreDefault && array_key_exists($alias, $sortRules)) {
             $sortColumns = $sortRules[$alias];
             if (!array_key_exists('columns', $sortColumns)) {
                 $sortColumns['columns'] = array($alias);
             }
             if ($direction !== null || !array_key_exists('order', $sortColumns)) {
                 $sortColumns['order'] = $direction ?: static::SORT_ASC;
             }
         } else {
             $sortColumns = array('columns' => array($alias), 'order' => $direction);
         }
     }
     $baseDirection = strtoupper($sortColumns['order']) === static::SORT_DESC ? static::SORT_DESC : static::SORT_ASC;
     foreach ($sortColumns['columns'] as $column) {
         list($column, $specificDirection) = $this->splitOrder($column);
         if ($this->hasLimit() && $this->repository->providesValueConversion($this->target, $column)) {
             Logger::debug('Cannot order by column "%s" in repository "%s". The query is' . ' limited and applies value conversion rules on the column', $column, $this->repository->getName());
             continue;
         }
         try {
             $this->query->order($this->repository->requireFilterColumn($this->target, $column, $this), $specificDirection ?: $baseDirection);
         } catch (QueryException $_) {
             Logger::info('Cannot order by column "%s" in repository "%s"', $column, $this->repository->getName());
         }
     }
     return $this;
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:57,代码来源:RepositoryQuery.php

示例9: createInstance

 /**
  * Create or return an instance of a given hook
  *
  * TODO: Should return some kind of a hook interface
  *
  * @param   string  $name   One of the predefined hook names
  * @param   string  $key    The identifier of a specific subtype
  *
  * @return  mixed
  */
 public static function createInstance($name, $key)
 {
     $name = self::normalizeHookName($name);
     if (!self::has($name, $key)) {
         return null;
     }
     if (isset(self::$instances[$name][$key])) {
         return self::$instances[$name][$key];
     }
     $class = self::$hooks[$name][$key];
     if (!class_exists($class)) {
         throw new ProgrammingError('Erraneous hook implementation, class "%s" does not exist', $class);
     }
     try {
         $instance = new $class();
     } catch (Exception $e) {
         Logger::debug('Hook "%s" (%s) (%s) failed, will be unloaded: %s', $name, $key, $class, $e->getMessage());
         // TODO: Persist unloading for "some time" or "current session"
         unset(self::$hooks[$name][$key]);
         return null;
     }
     self::assertValidHook($instance, $name);
     self::$instances[$name][$key] = $instance;
     return $instance;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:35,代码来源:Hook.php

示例10: detectInstalledModules

 /**
  * Detect installed modules from every path provided in modulePaths
  *
  * @param   array   $availableDirs      Installed modules location
  *
  * @return $this
  */
 public function detectInstalledModules(array $availableDirs = null)
 {
     $modulePaths = $availableDirs !== null ? $availableDirs : $this->modulePaths;
     foreach ($modulePaths as $basedir) {
         $canonical = realpath($basedir);
         if ($canonical === false) {
             Logger::warning('Module path "%s" does not exist', $basedir);
             continue;
         }
         if (!is_dir($canonical)) {
             Logger::error('Module path "%s" is not a directory', $canonical);
             continue;
         }
         if (!is_readable($canonical)) {
             Logger::error('Module path "%s" is not readable', $canonical);
             continue;
         }
         if (($dh = opendir($canonical)) !== false) {
             while (($file = readdir($dh)) !== false) {
                 if ($file[0] === '.') {
                     continue;
                 }
                 if (is_dir($canonical . '/' . $file)) {
                     if (!array_key_exists($file, $this->installedBaseDirs)) {
                         $this->installedBaseDirs[$file] = $canonical . '/' . $file;
                     } else {
                         Logger::debug('Module "%s" already exists in installation path "%s" and is ignored.', $canonical . '/' . $file, $this->installedBaseDirs[$file]);
                     }
                 }
             }
             closedir($dh);
         }
     }
     ksort($this->installedBaseDirs);
     return $this;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:43,代码来源:Manager.php

示例11: prepareNewConnection

 /**
  * Prepare and establish a connection with the LDAP server
  *
  * @return  resource        A LDAP link identifier
  *
  * @throws  LdapException   In case the connection is not possible
  */
 protected function prepareNewConnection()
 {
     if ($this->encryption === static::STARTTLS || $this->encryption === static::LDAPS) {
         $this->prepareTlsEnvironment();
     }
     $hostname = $this->hostname;
     if ($this->encryption === static::LDAPS) {
         $hostname = 'ldaps://' . $hostname;
     }
     $ds = ldap_connect($hostname, $this->port);
     // Usage of ldap_rename, setting LDAP_OPT_REFERRALS to 0 or using STARTTLS requires LDAPv3.
     // If this does not work we're probably not in a PHP 5.3+ environment as it is VERY
     // unlikely that the server complains about it by itself prior to a bind request
     ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
     // Not setting this results in "Operations error" on AD when using the whole domain as search base
     ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
     if ($this->encryption === static::STARTTLS) {
         if ($this->encryptionSuccess = @ldap_start_tls($ds)) {
             Logger::debug('LDAP STARTTLS succeeded');
         } else {
             Logger::error('LDAP STARTTLS failed: %s', ldap_error($ds));
             // ldap_start_tls seems to corrupt the connection though if I understand
             // https://tools.ietf.org/html/rfc4511#section-4.14.2 correctly, this shouldn't happen
             $ds = ldap_connect($hostname, $this->port);
             ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
             ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
         }
     } elseif ($this->encryption === static::LDAPS) {
         $this->encryptionSuccess = true;
     }
     return $ds;
 }
开发者ID:kain64,项目名称:icingaweb2,代码行数:39,代码来源:LdapConnection.php

示例12: retrieveGeneralizedTime

 /**
  * Parse the given value based on the ASN.1 standard (GeneralizedTime) and return its timestamp representation
  *
  * @param   string|null     $value
  *
  * @return  int
  */
 protected function retrieveGeneralizedTime($value)
 {
     if ($value === null) {
         return $value;
     }
     if (($dateTime = DateTime::createFromFormat('YmdHis.uO', $value)) !== false || ($dateTime = DateTime::createFromFormat('YmdHis.uZ', $value)) !== false || ($dateTime = DateTime::createFromFormat('YmdHis.u', $value)) !== false || ($dateTime = DateTime::createFromFormat('YmdHis', $value)) !== false || ($dateTime = DateTime::createFromFormat('YmdHi', $value)) !== false || ($dateTime = DateTime::createFromFormat('YmdH', $value)) !== false) {
         return $dateTime->getTimeStamp();
     } else {
         Logger::debug(sprintf('Failed to parse "%s" based on the ASN.1 standard (GeneralizedTime) in repository "%s".', $value, $this->getName()));
     }
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:18,代码来源:Repository.php

示例13: ldapSearch

 /**
  * Perform a LDAP search and return the result
  *
  * @param   LdapQuery   $query
  * @param   array       $attributes     An array of the required attributes
  * @param   int         $attrsonly      Should be set to 1 if only attribute types are wanted
  * @param   int         $sizelimit      Enables you to limit the count of entries fetched
  * @param   int         $timelimit      Sets the number of seconds how long is spend on the search
  * @param   int         $deref
  *
  * @return  resource|bool               A search result identifier or false on error
  *
  * @throws  LogicException              If the LDAP query search scope is unsupported
  */
 public function ldapSearch(LdapQuery $query, array $attributes = null, $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER)
 {
     $queryString = (string) $query;
     $baseDn = $query->getBase() ?: $this->getDn();
     $scope = $query->getScope();
     if (Logger::getInstance()->getLevel() === Logger::DEBUG) {
         // We're checking the level by ourself to avoid rendering the ldapsearch commandline for nothing
         $starttlsParam = $this->encryption === static::STARTTLS ? ' -ZZ' : '';
         $ldapUrl = ($this->encryption === static::LDAPS ? 'ldaps://' : 'ldap://') . $this->hostname . ($this->port ? ':' . $this->port : '');
         if ($this->bound) {
             $bindParams = ' -D "' . $this->bindDn . '"' . ($this->bindPw ? ' -W' : '');
         }
         if ($deref === LDAP_DEREF_NEVER) {
             $derefName = 'never';
         } elseif ($deref === LDAP_DEREF_ALWAYS) {
             $derefName = 'always';
         } elseif ($deref === LDAP_DEREF_SEARCHING) {
             $derefName = 'search';
         } else {
             // $deref === LDAP_DEREF_FINDING
             $derefName = 'find';
         }
         Logger::debug("Issueing LDAP search. Use '%s' to reproduce.", sprintf('ldapsearch -P 3%s -H "%s"%s -b "%s" -s "%s" -z %u -l %u -a "%s"%s%s%s', $starttlsParam, $ldapUrl, $bindParams, $baseDn, $scope, $sizelimit, $timelimit, $derefName, $attrsonly ? ' -A' : '', $queryString ? ' "' . $queryString . '"' : '', $attributes ? ' "' . join('" "', $attributes) . '"' : ''));
     }
     switch ($scope) {
         case LdapQuery::SCOPE_SUB:
             $function = 'ldap_search';
             break;
         case LdapQuery::SCOPE_ONE:
             $function = 'ldap_list';
             break;
         case LdapQuery::SCOPE_BASE:
             $function = 'ldap_read';
             break;
         default:
             throw new LogicException('LDAP scope %s not supported by ldapSearch', $scope);
     }
     return @$function($this->getConnection(), $baseDn, $queryString, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:53,代码来源:LdapConnection.php

示例14: persistUserName

 /**
  * Return the distinguished name for the given uid or gid
  *
  * @param   string  $name
  *
  * @return  string
  */
 protected function persistUserName($name)
 {
     try {
         $userDn = $this->ds->select()->from($this->userClass, array())->where($this->userNameAttribute, $name)->setBase($this->userBaseDn)->setUsePagedResults(false)->fetchDn();
         if ($userDn) {
             return $userDn;
         }
         $groupDn = $this->ds->select()->from($this->groupClass, array())->where($this->groupNameAttribute, $name)->setBase($this->groupBaseDn)->setUsePagedResults(false)->fetchDn();
         if ($groupDn) {
             return $groupDn;
         }
     } catch (LdapException $_) {
         // pass
     }
     Logger::debug('Unable to persist uid or gid "%s" in repository "%s". No DN found.', $name, $this->getName());
     return $name;
 }
开发者ID:santospm,项目名称:icingaweb2,代码行数:24,代码来源:LdapUserGroupBackend.php

示例15: __toString

 /**
  * @return string
  */
 public function __toString()
 {
     try {
         $select = (string) $this->getSelectQuery();
         return $this->getIsSubQuery() ? '(' . $select . ')' : $select;
     } catch (Exception $e) {
         Logger::debug('Failed to render DbQuery. An error occured: %s', $e);
         return '';
     }
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:13,代码来源:DbQuery.php


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