Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/yiisoft/yii2/log/ |
Upload File : |
<?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yii\log; use Yii; use yii\helpers\VarDumper; /** * SyslogTarget writes log to syslog. * * @author miramir <gmiramir@gmail.com> * @since 2.0 */ class SyslogTarget extends Target { /** * @var string syslog identity */ public $identity; /** * @var int syslog facility. */ public $facility = LOG_USER; /** * @var int|null openlog options. This is a bitfield passed as the `$option` parameter to [openlog()](https://www.php.net/openlog). * Defaults to `null` which means to use the default options `LOG_ODELAY | LOG_PID`. * @see https://www.php.net/openlog for available options. * @since 2.0.11 */ public $options; /** * @var array syslog levels */ private $_syslogLevels = [ Logger::LEVEL_TRACE => LOG_DEBUG, Logger::LEVEL_PROFILE_BEGIN => LOG_DEBUG, Logger::LEVEL_PROFILE_END => LOG_DEBUG, Logger::LEVEL_PROFILE => LOG_DEBUG, Logger::LEVEL_INFO => LOG_INFO, Logger::LEVEL_WARNING => LOG_WARNING, Logger::LEVEL_ERROR => LOG_ERR, ]; /** * {@inheritdoc} */ public function init() { parent::init(); if ($this->options === null) { $this->options = LOG_ODELAY | LOG_PID; } } /** * Writes log messages to syslog. * Starting from version 2.0.14, this method throws LogRuntimeException in case the log can not be exported. * @throws LogRuntimeException */ public function export() { openlog($this->identity, $this->options, $this->facility); foreach ($this->messages as $message) { if (syslog($this->_syslogLevels[$message[1]], $this->formatMessage($message)) === false) { throw new LogRuntimeException('Unable to export log through system log!'); } } closelog(); } /** * {@inheritdoc} */ public function formatMessage($message) { list($text, $level, $category, $timestamp) = $message; $level = Logger::getLevelName($level); if (!is_string($text)) { // exceptions may not be serializable if in the call stack somewhere is a Closure if ($text instanceof \Exception || $text instanceof \Throwable) { $text = (string) $text; } else { $text = VarDumper::export($text); } } $prefix = $this->getMessagePrefix($message); return "{$prefix}[$level][$category] $text"; } }