• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP openlog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: log

 public function log()
 {
     $argsNum = func_num_args();
     if ($argsNum < 2) {
         return false;
     }
     $args = func_get_args();
     $priority = $args[0];
     $message = $args[1];
     if ($priority > $this->allowPriority) {
         return false;
     }
     $priorityName = $this->getLevelName($priority);
     $strLog = '';
     if ($priorityName) {
         $strLog = "[{$priorityName}]";
     }
     $strLog .= "{$message}";
     for ($i = 2; $i < $argsNum; $i++) {
         $strLog .= $args[$i];
     }
     openlog('SPF', LOG_PID, LOG_USER);
     syslog($priority, $strLog);
     closelog();
 }
开发者ID:zhxia,项目名称:nspf,代码行数:25,代码来源:SysLogger.php


示例17: write

 /**
  * {@inheritdoc}
  */
 protected function write(array $record)
 {
     if (!openlog($this->ident, $this->logopts, $this->facility)) {
         throw new \LogicException('Can\'t open syslog for ident "' . $this->ident . '" and facility "' . $this->facility . '"');
     }
     syslog($this->logLevels[$record['level']], (string) $record['formatted']);
 }
开发者ID:xudianyang,项目名称:yafrk-lib,代码行数:10,代码来源:SyslogHandler.php


示例18: write

 public static function write($stack)
 {
     if (self::$isOpen === false) {
         $default = array('ident' => 'PhotonApp', 'facility' => LOG_USER, 'option' => LOG_CONS | LOG_NDELAY | LOG_PID);
         $conf = Conf::f('log_syslog', $default);
         $conf = array_merge($default, $conf);
         // Windows can log only in LOG_USER
         if (substr(PHP_OS, 0, 3) === 'WIN') {
             $conf['facility'] = LOG_USER;
         }
         $rc = openlog($conf['ident'], $conf['option'], $conf['facility']);
         if ($rc === true) {
             self::$isOpen = true;
         }
     }
     foreach ($stack as $elt) {
         $level = self::$photon2syslog[$elt[1]];
         if (is_array($elt[2]) || is_object($elt[2])) {
             $msg = json_encode($elt[2]);
         } else {
             $msg = $elt[2];
         }
         syslog($level, $msg);
     }
     return false;
 }
开发者ID:photon,项目名称:log-syslog,代码行数:26,代码来源:SyslogBackend.php


示例19: initialize

 /**
  * @see \Components\Log_Appender_Abstract::initialize() initialize
  */
 public function initialize()
 {
     if (false === $this->m_initialized) {
         parent::initialize();
         openlog($this->name, $this->options, $this->facility);
     }
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.runtime,代码行数:10,代码来源:syslog.php


示例20: LogInfo

function LogInfo($msg)
{
    global $argv;
    openlog($argv[0], LOG_PID, LOG_USER);
    syslog(LOG_INFO, $msg);
    closelog();
}
开发者ID:warkx,项目名称:Synology-DownloadStation-Hosts,代码行数:7,代码来源:common.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP openpage函数代码示例发布时间:2022-05-15
下一篇:
PHP openld_htmlspecialchars函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap