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


PHP openlog函数代码示例

本文整理汇总了PHP中openlog函数的典型用法代码示例。如果您正苦于以下问题:PHP openlog函数的具体用法?PHP openlog怎么用?PHP openlog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: prepare

 /**
  * Prepares use of logger.
  *
  * This method may be called to switch previous name of application. It
  * might be called at any time as it's preventing multiple preparations
  * internally.
  *
  * @param string $applicationName name of application to show in logs
  */
 public static function prepare($applicationName = null)
 {
     if (!self::$prepared || $applicationName !== null && $applicationName !== self::$prepared) {
         openlog($applicationName !== null ? "TXF.{$applicationName}" : 'TXF', LOG_NDELAY + LOG_PID, LOG_USER);
         self::$prepared = $applicationName !== null ? $applicationName : true;
     }
 }
开发者ID:cepharum,项目名称:txf,代码行数:16,代码来源:log.php

示例2: __construct

 function __construct($_sFeaturePath, $_iPort = 16816)
 {
     openlog("cuke4php", LOG_PID, LOG_DAEMON);
     if (is_file($_sFeaturePath)) {
         $_sFeaturePath = dirname($_sFeaturePath);
     }
     if ($_iPort > 0) {
         $this->iPort = $_iPort;
     } else {
         $this->iPort = 16816;
     }
     foreach (self::rglob("*.php", 0, $_sFeaturePath . "/support") as $sFilename) {
         require_once $sFilename;
     }
     set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT);
     require_once "Cucumber.php";
     foreach (self::rglob("*.php", 0, $_sFeaturePath . "/step_definitions") as $sFilename) {
         require_once $sFilename;
     }
     $this->aStepClasses = CucumberSteps::getSubclasses();
     foreach ($this->aStepClasses as $sClass) {
         $oReflection = new ReflectionClass($sClass);
         $aMethods = $oReflection->getMethods();
         foreach ($aMethods as $oMethod) {
             $sComment = $oMethod->getDocComment();
             $aMatches = array();
             $aMethod = array();
             $aMethod['method'] = $oMethod->name;
             $aMethod['class'] = $oMethod->class;
             $aMethod['filename'] = $oMethod->getFileName();
             $aMethod['startline'] = $oMethod->getStartLine();
             if (substr($oMethod->name, 0, 4) === "step") {
                 preg_match("/(?:Given|When|Then) (.+)\$/im", $sComment, $aMatches);
                 $aMethod['regexp'] = $aMatches[1];
                 $this->aWorld['steps'][] = $aMethod;
                 continue;
             }
             preg_match("/(@.+)/im", $sComment, $aMatches);
             if (array_key_exists(1, $aMatches)) {
                 $aMethod['tags'] = explode(" ", str_replace("@", "", $aMatches[1]));
             } else {
                 $aMethod['tags'] = array();
             }
             if (substr($oMethod->name, 0, 6) === "before") {
                 $this->aWorld['before'][] = $aMethod;
                 continue;
             }
             if (substr($oMethod->name, 0, 5) === "after") {
                 $this->aWorld['after'][] = $aMethod;
                 continue;
             }
             if (substr($oMethod->name, 0, 9) == "transform") {
                 preg_match("/(?:Transform) (.+)\$/im", $sComment, $aMatches);
                 $aMethod['regexp'] = $aMatches[1];
                 $this->aWorld['transform'][] = $aMethod;
                 continue;
             }
         }
     }
 }
开发者ID:nathanbrakken,项目名称:cuke4php,代码行数:60,代码来源:Cuke4Php.php

示例3: __construct

 function __construct(array $params = array())
 {
     if (isset($params['application'])) {
         $this->_appName = $params['application'];
     }
     openlog($this->_appName, LOG_PID, LOG_USER);
 }
开发者ID:eason007,项目名称:e-fw,代码行数:7,代码来源:Syslog.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param   array  &$options  Log object options.
  *
  * @since   11.1
  */
 public function __construct(array &$options)
 {
     // Call the parent constructor.
     parent::__construct($options);
     // Ensure that we have an identity string for the Syslog entries.
     if (empty($this->options['sys_ident'])) {
         $this->options['sys_ident'] = 'Joomla Platform';
     }
     // If the option to add the process id to Syslog entries is set use it, otherwise default to true.
     if (isset($this->options['sys_add_pid'])) {
         $this->options['sys_add_pid'] = (bool) $this->options['sys_add_pid'];
     } else {
         $this->options['sys_add_pid'] = true;
     }
     // If the option to also send Syslog entries to STDERR is set use it, otherwise default to false.
     if (isset($this->options['sys_use_stderr'])) {
         $this->options['sys_use_stderr'] = (bool) $this->options['sys_use_stderr'];
     } else {
         $this->options['sys_use_stderr'] = false;
     }
     // Build the Syslog options from our log object options.
     $sysOptions = 0;
     if ($this->options['sys_add_pid']) {
         $sysOptions = $sysOptions | LOG_PID;
     }
     if ($this->options['sys_use_stderr']) {
         $sysOptions = $sysOptions | LOG_PERROR;
     }
     // Open the Syslog connection.
     openlog((string) $this->options['sys_ident'], $sysOptions, LOG_USER);
 }
开发者ID:houzhenggang,项目名称:cobalt,代码行数:38,代码来源:syslog.php

示例5: write

 public function write(string $level, string $message)
 {
     $l = LOG_INFO;
     $message = $this->interpolate($level, $message);
     switch ($level) {
         case 'emergency':
         case 'alert':
         case 'critical':
         case 'error':
         case 'warning':
             $l = LOG_WARNING;
             break;
         case 'notice':
             $l = LOG_NOTICE;
             break;
         case 'debug':
             $l = LOG_DEBUG;
             break;
         default:
             break;
     }
     if (\openlog($this->ident, LOG_PID, LOG_USER)) {
         \syslog($l, $message);
     }
 }
开发者ID:coenbijlsma,项目名称:dashboard-backend,代码行数:25,代码来源:SyslogOutput.php

示例6: open

 /**
  * Opens a connection to the system logger, if it has not already
  * been opened.  This is implicitly called by log(), if necessary.
  * @access public
  */
 function open()
 {
     if (!$this->_opened) {
         $this->_opened = openlog($this->_ident, LOG_PID, $this->_name);
     }
     return $this->_opened;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:12,代码来源:syslog.php

示例7: __construct

 function __construct($name = 'ykval')
 {
     $this->name = $name;
     $this->fields = array();
     $this->LOG_LEVELS = array(LOG_EMERG => 'LOG_EMERG', LOG_ALERT => 'LOG_ALERT', LOG_CRIT => 'LOG_CRIT', LOG_ERR => 'LOG_ERR', LOG_WARNING => 'LOG_WARNING', LOG_NOTICE => 'LOG_NOTICE', LOG_INFO => 'LOG_INFO', LOG_DEBUG => 'LOG_DEBUG');
     openlog("ykval", LOG_PID, LOG_LOCAL0);
 }
开发者ID:netcetera,项目名称:yubikey-val-server-php,代码行数:7,代码来源:ykval-log.php

示例8: log

 /**
  * Write a log message to the log socket.
  *
  * @param int    $priority   The priority.
  * @param string $message    The message.
  * @param string $ident      Defaults to the ident set via setIdent()
  * @param int    $date       Timestamp for log message. Defaults to now.
  *
  * @return \YapepBase\Syslog\LegacySyslogConnection
  *
  * @throws \YapepBase\Exception\SyslogException on error
  * @throws \YapepBase\Exception\NotImplementedException if the date is set, because this implementation
  *                                                      doesn't support it.
  */
 public function log($priority, $message, $ident = null, $date = null)
 {
     $this->validatePriority($priority);
     $this->validateIdent($ident);
     if (!\is_null($date)) {
         throw new NotImplementedException('PHP\'s internal syslog functions don\'t support passing the date');
     }
     if (!is_string($ident)) {
         $ident = $this->ident;
     }
     if (!openlog($ident, $this->options, $this->facility)) {
         throw new SyslogException('openlog() failed');
     } else {
         if (!syslog($priority, $message)) {
             $e = new SyslogException('syslog() failed');
         }
         if (!closelog()) {
             if (isset($e)) {
                 throw new SyslogException('syslog() and closelog() failed');
             } else {
                 throw new SyslogException('closelog() failed');
             }
         } elseif (isset($e)) {
             throw $e;
         }
     }
     return $this;
 }
开发者ID:szeber,项目名称:yapep_base,代码行数:42,代码来源:LegacySyslogConnection.php

示例9: processData

function processData()
{
    $flag = false;
    $firstName = $_POST['firstname'];
    if (strlen($firstName) == 0) {
        $flag = true;
    }
    $lastName = $_POST['lastname'];
    if (strlen($lastName) == 0) {
        $flag = true;
    }
    $emailAddress = $_POST['emailaddress'];
    if (strlen($emailAddress) == 0) {
        $flag = true;
    }
    if ($flag == false) {
        openlog('php', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR);
        syslog(LOG_ERR, 'Error!');
        syslog(LOG_INFO, "{$firstName} {$lastName} {$emailAddress}");
        closelog();
        echo "<style type='text/css'>#formContainer{display:none;}</style>";
        echo "\n\t\t\t\t\t\t\t\t\t\t<h3 class='FormLabel'>SUCCESS!</h3>\n\t\t\t\t\t\t\t\t\t\tThank you for creating an account {$firstName} {$lastName}!\n\t\t\t\t\t\t\t\t\t\tA confirmation email has been sent to {$emailAddress}.\n\t\t\t\t\t\t\t\t\t\tOnce you receive this email please follow the instructions\n\t\t\t\t\t\t\t\t\t\tprovided to active your new account.\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<h6>This page will refresh in 10 seconds...</h6>\n\t\t\t\t\t\t\t\t\t";
        header("refresh:10;url=index.php");
    }
}
开发者ID:andrmc01,项目名称:Clemson-Exercise-2,代码行数:25,代码来源:Index.php

示例10: init

 public static function init($ident, $facility)
 {
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         self::$facilities['local0'] = LOG_LOCAL0;
         self::$facilities['local1'] = LOG_LOCAL1;
         self::$facilities['local2'] = LOG_LOCAL2;
         self::$facilities['local3'] = LOG_LOCAL3;
         self::$facilities['local4'] = LOG_LOCAL4;
         self::$facilities['local5'] = LOG_LOCAL5;
         self::$facilities['local6'] = LOG_LOCAL6;
         self::$facilities['local7'] = LOG_LOCAL7;
     }
     if (array_key_exists(strtolower($facility), self::$facilities)) {
         $facility = self::$facilities[strtolower($facility)];
     } elseif (!in_array($facility, array_values(self::$facilities), true)) {
         throw new \UnexpectedValueException('Unknown facility value "' . $facility . '"');
     }
     return function ($info) use($ident, $facility) {
         if (!openlog($ident, LOG_PID, $facility)) {
             throw new \LogicException('Can\'t open syslog for ident "' . $ident . '" and facility "' . $facility . '"');
         }
         syslog(Syslog::$levels[$info['level']], vsprintf('%1$s: %4$s', $info));
         closelog();
     };
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:25,代码来源:Syslog.php

示例11: logMessage

function logMessage($type, $level, $message)
{
    global $debug;
    global $use_syslog;
    if ($use_syslog) {
        define_syslog_variables();
        if ($debug) {
        }
        if ($level == 0) {
            $s_level = LOG_ERR;
        } else {
            if ($level == 1) {
                $s_level = LOG_WARNING;
            } else {
                if ($level == 2) {
                    $s_level = LOG_INFO;
                } else {
                    if ($level == 3) {
                        $s_level = LOG_DEBUG;
                    } else {
                        $s_level = LOG_ERR;
                    }
                }
            }
        }
        $s_message = $type . " " . $message;
        openlog("restbot", LOG_PID, LOG_DAEMON);
        syslog($s_level, $s_message);
        closelog();
    }
}
开发者ID:GwynethLlewelyn,项目名称:restbot,代码行数:31,代码来源:funktions.php

示例12: _log

function _log($text)
{
    _trace($text);
    openlog("alarm", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, var_export($text));
    closelog();
}
开发者ID:adexbn,项目名称:gds_alarm,代码行数:7,代码来源:inc_db.php

示例13: __construct

 /**
  * class constructor opens syslog with passed log ident and options
  *
  * @error 12101
  * @param string $ident expects log identifier
  * @param int $facility expects optional bitmasked values
  * @throws Xapp_Log_Writer_Exception
  */
 public function __construct($ident = 'Xapp', $facility = LOG_USER)
 {
     $this->_ident = trim((string) $ident);
     if (!openlog($this->_ident, LOG_CONS, $facility)) {
         throw new Xapp_Log_Writer_Exception(_("unable to open sys log with passed parameters"), 1210101);
     }
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:15,代码来源:Sys.php

示例14: __construct

 public function __construct()
 {
     $this->config = \Jelix\Core\App::config()->syslogLogger;
     $this->catSyslog = array('error' => LOG_ERR, 'warning' => LOG_WARNING, 'notice' => LOG_NOTICE, 'deprecated' => LOG_NOTICE, 'strict' => LOG_NOTICE, 'debug' => LOG_DEBUG);
     $ident = strtr($this->config['ident'], array('%sapi%' => php_sapi_name(), '%domain%' => \Jelix\Core\App::config()->domainName, '%pid%' => getmypid()));
     openlog($ident, LOG_ODELAY | LOG_PERROR, $this->config['facility']);
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:7,代码来源:Syslog.php

示例15: writeLog

 public function writeLog($message = null, $code = null)
 {
     if (empty($this->message) && empty($message)) {
         return;
     } else {
         $this->message = $message;
     }
     if (empty($this->code) && empty($code)) {
         $this->code = 0;
     } else {
         $this->code = $code;
     }
     if (openlog(LoggingConfig::LOG_IDENT, LOG_PID | LOG_CONS, LoggingConfig::LOG_FACILITY) === true) {
         $entries = explode("\n", $this->message);
         foreach ($entries as $entry) {
             syslog(LOG_INFO, sprintf("(%s) [%s] %s %s %s - %s", $this->ip, $this->user, strtoupper($this->method), $this->code, $this->uri, $entry));
         }
         if (LoggingConfig::LOG_DEBUG == true && !empty($this->input) && $this->input != "null") {
             syslog(LOG_DEBUG, sprintf("(%s) [%s] Input: %s", $this->ip, $this->user, $this->input));
         }
         if (LoggingConfig::LOG_DEBUG == true && !empty($this->output) && $this->output != "null") {
             syslog(LOG_DEBUG, sprintf("(%s) [%s] Output: %s", $this->ip, $this->user, $this->output));
         }
         closelog();
     } else {
         trigger_error("Could not open syslog facility", E_USER_ERROR);
     }
 }
开发者ID:vdchuyen,项目名称:TonicDNS,代码行数:28,代码来源:logger.php


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