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

PHP syslog函数代码示例

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

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



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

示例1: get_instance

 function get_instance($id, $name)
 {
     global $KERNEL_INFO_TABLE;
     $db = openqrm_get_db_connection();
     if ("{$id}" != "") {
         $kernel_array = $db->Execute("select * from {$KERNEL_INFO_TABLE} where kernel_id={$id}");
     } else {
         if ("{$name}" != "") {
             $kernel_array = $db->Execute("select * from {$KERNEL_INFO_TABLE} where kernel_name='{$name}'");
         } else {
             $this->__event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Could not create instance of kernel without data", "", "", 0, 0, 0);
             foreach (debug_backtrace() as $key => $msg) {
                 syslog(LOG_ERR, $msg['function'] . '() ' . basename($msg['file']) . ':' . $msg['line']);
             }
             return;
         }
     }
     foreach ($kernel_array as $index => $kernel) {
         $this->id = $kernel["kernel_id"];
         $this->name = $kernel["kernel_name"];
         $this->version = $kernel["kernel_version"];
         $this->capabilities = $kernel["kernel_capabilities"];
         $this->comment = $kernel["kernel_comment"];
     }
     return $this;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:26,代码来源:kernel.class.php


示例2: 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


示例3: save

 function save($filename, $image_type = IMAGETYPE_JPEG, $compression = 80)
 {
     if (!$this->image) {
         return false;
     }
     if ($image_type == -1) {
         // Save in the same format
         $image_type = $this->image_type;
     }
     switch ($image_type) {
         case IMAGETYPE_JPEG:
             $res = imagejpeg($this->image, $filename, $compression);
             break;
         case IMAGETYPE_GIF:
             $res = imagegif($this->image, $filename);
             break;
         case IMAGETYPE_PNG:
             $res = imagepng($this->image, $filename);
             break;
         default:
             syslog(LOG_INFO, "IMAGE not type found: {$image_type}");
             return false;
     }
     if ($res) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:29,代码来源:simpleimage.php


示例4: 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


示例5: saveContacts

function saveContacts($contacts)
{
    global $contacts_file;
    // parse permissions
    if (!file_exists($contacts_file)) {
        echo 'error: notes file ' . $contacts_file . ' does not exist';
        return;
    }
    if (!is_writable($contacts_file)) {
        echo 'error: cannot write projects file (' . $contacts_file . ')';
        return;
    }
    // lets sort the contacts alphabetically first
    //sort($contacts);
    //echo ("{ \"message\": \"save these values: " . join($contacts) . "\"}");
    // be more careful here, we need to write first to a new file, make sure that this
    // works and copy the result over to the pw_file
    $testfn = $contacts_file . '_test';
    file_put_contents($testfn, json_encode($contacts, JSON_PRETTY_PRINT));
    if (filesize($testfn) > 0) {
        // seems to have worked, now rename this file to pw_file
        rename($testfn, $contacts_file);
    } else {
        syslog(LOG_EMERG, 'error: could not write file into ' . $testfn);
    }
}
开发者ID:ABCD-STUDY,项目名称:timeline-followback,代码行数:26,代码来源:getSessions.php


示例6: fwLog

function fwLog($str)
{
    global $STDIN, $STDOUT, $STDERR;
    $lfstat = @stat("/tmp/firewall.log");
    if (is_array($lfstat) && $lfstat['size'] > 1048576) {
        // Logfile is over 1mb
        @unlink("/tmp/firewall.log.old");
        rename("/tmp/firewall.log", "/tmp/firewall.log.old");
        // This is so hacky.
        if (is_resource($STDIN)) {
            fclose($STDIN);
            fclose($STDOUT);
            fclose($STDERR);
            $STDIN = fopen('/dev/null', 'r');
            $STDOUT = fopen('/tmp/firewall.log', 'ab');
            $STDERR = fopen('/tmp/firewall.err', 'ab');
        }
        print "Rotated Log\n";
    }
    print time() . ": {$str}\n";
    // No need to write to the logfile, as we're sending it there already by the print
    // $fh = fopen("/tmp/firewall.log", "a");
    // fwrite($fh, time().": $str\n");
    syslog(LOG_WARNING | LOG_LOCAL0, $str);
}
开发者ID:ntadmin,项目名称:firewall,代码行数:25,代码来源:common.php


示例7: Debuglogs

function Debuglogs($text = null, $function = null, $line = null)
{
    if (!$GLOBALS["DEBUG"]) {
        return;
    }
    if ($text == null) {
        return;
    }
    $linetext = null;
    if ($function == null) {
        if (function_exists("debug_backtrace")) {
            $trace = @debug_backtrace();
        }
        if (is_array($trace)) {
            $filename = basename($trace[1]["file"]);
            $function = $trace[1]["function"];
            $line = $trace[1]["line"];
        }
    }
    $linetext = $text;
    if ($function != null) {
        $linetext = "{$function}/{$line} {$linetext}";
    } else {
        if ($line != null) {
            $linetext = "{$line} {$linetext}";
        }
    }
    if (function_exists("syslog")) {
        $LOG_SEV = LOG_INFO;
        openlog("error_page", LOG_PID, LOG_SYSLOG);
        syslog($LOG_SEV, $linetext);
        closelog();
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:nginx.error.php


示例8: logEvent

function logEvent($logLine, $logType = LOG_INFO)
{
    global $logFile, $useSysLog, $logFd, $auth;
    $attr = array();
    if (isset($auth['name'])) {
        $attr[] = $auth['name'];
    }
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $attr[] = $_SERVER['REMOTE_ADDR'];
    }
    if (count($attr)) {
        $logLine = '[' . implode(", ", $attr) . '] ' . $logLine;
    }
    if ($logType == LOG_ERR) {
        $logLine = 'error: ' . $logLine;
    }
    if ($useSysLog) {
        syslog($logType, $logLine);
    } elseif (!isset($logFd)) {
        if ($logType == LOG_ERR) {
            error_log('DL: ' . $logLine);
        }
    } else {
        $logLine = "[" . date(DATE_W3C) . "] {$logLine}\n";
        flock($logFd, LOCK_EX);
        fseek($logFd, 0, SEEK_END);
        fwrite($logFd, $logLine);
        fflush($logFd);
        flock($logFd, LOCK_UN);
    }
}
开发者ID:dg-wfk,项目名称:dl,代码行数:31,代码来源:funcs.php


示例9: 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


示例10: SetElements

 public function SetElements($id, $elements)
 {
     $es = (array) $elements;
     foreach ($es as $a) {
         // Force as an array
         $a = (array) $a;
         // Preprocessing
         $a['form_id'] = $id;
         // If id = 0, process as new entry
         if ((int) $a['id'] == 0) {
             syslog(LOG_DEBUG, "SetElements: adding new address for {$id}");
             $GLOBALS['sql']->load_data($a);
             $query = $GLOBALS['sql']->insert_query('xmr_element', $this->element_keys);
             $GLOBALS['sql']->query($query);
         } else {
             if ($a['altered']) {
                 syslog(LOG_DEBUG, "SetElements: modifying address for form {$id}, id = " . $a['id']);
                 $GLOBALS['sql']->load_data($a);
                 $query = $GLOBALS['sql']->update_query('xmr_element', $this->element_keys, array('id' => $a['id']));
                 $GLOBALS['sql']->query($query);
             }
         }
     }
     return true;
 }
开发者ID:rrsc,项目名称:freemed,代码行数:25,代码来源:Xmr.class.php


示例11: log

 public function log($err)
 {
     if (!is_string($err['message'])) {
         $err['message'] = print_r($err['message'], true);
     }
     syslog(LOG_WARNING, 'error in file: ' . $err['file'] . ' (line ' . $err['line'] . '). ' . $err['message']);
 }
开发者ID:atlantis3001,项目名称:nofussframework,代码行数:7,代码来源:Syslog.php


示例12: log_debug

 static function log_debug($msg, $skip_trace = 1)
 {
     if (strlen(Config::get('app.loglevel')) < 5) {
         return;
     }
     syslog(LOG_DEBUG, Util::get_trace($skip_trace) . $msg);
 }
开发者ID:252114997,项目名称:ourshow,代码行数:7,代码来源:UtilController.php


示例13: syslog_msg

/**
 * Verify that syslog logging is activated in the config via the
 * debug->syslog variable and does a call to the syslog() function is it
 * is true.
 *
 * @param emergency	Syslog emergency.
 * @param log_string String to log.
 */
function syslog_msg($emergency, $log_string)
{
    if (!function_exists('syslog') || !isset($_SESSION[APPCONFIG]) || !$_SESSION[APPCONFIG]->getValue('debug', 'syslog')) {
        return;
    }
    return syslog($emergency, $log_string);
}
开发者ID:dannylsl,项目名称:phpLDAPadmin,代码行数:15,代码来源:syslog.php


示例14: 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


示例15: output

 protected function output($level, $msg)
 {
     // map logging levels to syslog priority levels
     $priorities = array(LogLevel::EMERGENCY => LOG_EMERG, LogLevel::ALERT => LOG_ALERT, LogLevel::CRITICAL => LOG_CRIT, LogLevel::ERROR => LOG_ERR, LogLevel::WARNING => LOG_WARNING, LogLevel::NOTICE => LOG_NOTICE, LogLevel::INFO => LOG_INFO, LogLevel::DEBUG => LOG_DEBUG);
     $priority = isset($priorities[$level]) ? $priorities[$level] : LOG_INFO;
     syslog($priority, $this->prefix . $msg);
 }
开发者ID:gamernetwork,项目名称:yolk-log,代码行数:7,代码来源:SysLogger.php


示例16: 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


示例17: write

	/**
	 * Writes each of the messages into the syslog.
	 *
	 * @param   array   messages
	 * @return  void
	 */
	public function write(array $messages)
	{
		foreach ($messages as $message)
		{
			syslog($this->_syslog_levels[$message['type']], $message['body']);
		}
	}
开发者ID:nevermlnd,项目名称:cv,代码行数:13,代码来源:syslog.php


示例18: get

 public function get($property_name)
 {
     if (!property_exists($this, $property_name)) {
         syslog(LOG_ERR, 'Lib class does not have such property ' . $property_name);
     }
     return $this->{$property_name};
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:7,代码来源:base-lib.php


示例19: update

 public function update(\SplSubject $subject, $logs = array(), $groups = array())
 {
     $bottomLogs = array();
     foreach ($logs as &$log) {
         if (is_array($log)) {
             if (count($log) > 0) {
                 if ($groups[$log[0]->group]->onBottom) {
                     $groups[$log[0]->group] = clone $groups[$log[0]->group];
                     $bottomLogs[] = $log;
                     $groups[$log[0]->group]->onBottom = false;
                 } else {
                     syslog($log[0]->level, $groups[$log[0]->group]->label);
                     foreach ($log as &$l) {
                         syslog($l->level, $l->message);
                     }
                     syslog($log[0]->level, $groups[$log[0]->group]->label);
                 }
             }
         } else {
             syslog($log->level, $log->message);
         }
     }
     if (count($bottomLogs) > 0) {
         $this->update($subject, $bottomLogs, $groups);
     }
 }
开发者ID:eric-burel,项目名称:twentyparts,代码行数:26,代码来源:Syslog.class.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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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