function SysLog::openConnection

Same name in other branches
  1. 9 core/modules/syslog/src/Logger/SysLog.php \Drupal\syslog\Logger\SysLog::openConnection()
  2. 8.9.x core/modules/syslog/src/Logger/SysLog.php \Drupal\syslog\Logger\SysLog::openConnection()
  3. 11.x core/modules/syslog/src/Logger/SysLog.php \Drupal\syslog\Logger\SysLog::openConnection()

Opens a connection to the system logger.

1 call to SysLog::openConnection()
SysLog::log in core/modules/syslog/src/Logger/SysLog.php

File

core/modules/syslog/src/Logger/SysLog.php, line 55

Class

SysLog
Redirects logging messages to syslog.

Namespace

Drupal\syslog\Logger

Code

protected function openConnection() {
    if (!$this->connectionOpened) {
        // Do not connect if identity or facility are not configured.
        $identity = $this->config
            ->get('identity');
        $facility = $this->config
            ->get('facility');
        if ($identity === NULL || $facility === NULL) {
            return;
        }
        $this->connectionOpened = openlog($identity, LOG_NDELAY, $facility);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.