class SysLog implements LoggerInterface (View source)

Redirects logging messages to syslog.

Traits

A copy of \Psr\Log\LoggerTrait that uses RFC 5424 compliant log levels.

Properties

protected Config $config

A configuration object containing syslog settings.

protected LogMessageParserInterface $parser

The message's placeholders parser.

protected bool $connectionOpened

Stores whether there is a system logger connection opened or not.

Methods

emergency($message, array $context = [])

{@inheritdoc}

alert($message, array $context = [])

{@inheritdoc}

critical($message, array $context = [])

{@inheritdoc}

error($message, array $context = [])

{@inheritdoc}

warning($message, array $context = [])

{@inheritdoc}

notice($message, array $context = [])

{@inheritdoc}

info($message, array $context = [])

{@inheritdoc}

debug($message, array $context = [])

{@inheritdoc}

log($level, $message, array $context = [])

{@inheritdoc}

__construct(ConfigFactoryInterface $config_factory, LogMessageParserInterface $parser)

Constructs a SysLog object.

openConnection()

Opens a connection to the system logger.

syslogWrapper(int $level, string $entry)

A syslog wrapper to make syslog functionality testable.

Details

emergency($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

alert($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

critical($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

error($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

warning($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

notice($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

info($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

debug($message, array $context = [])

{@inheritdoc}

Parameters

$message
array $context

log($level, $message, array $context = [])

{@inheritdoc}

Parameters

$level
$message
array $context

__construct(ConfigFactoryInterface $config_factory, LogMessageParserInterface $parser)

Constructs a SysLog object.

Parameters

ConfigFactoryInterface $config_factory

The configuration factory object.

LogMessageParserInterface $parser

The parser to use when extracting message variables.

protected openConnection()

Opens a connection to the system logger.

protected syslogWrapper(int $level, string $entry)

A syslog wrapper to make syslog functionality testable.

Parameters

int $level

The syslog priority.

string $entry

The message to send to syslog function.