Skip to content

Yii

Yii Logging Library - Syslog Target


Latest Stable VersionTotal DownloadsBuild statusScrutinizer Code QualityCode CoverageMutation testing badgestatic analysistype-coverage

This package provides the Syslog target for the yiisoft/log library.

Requirements

  • PHP 8.0 or higher.

Installation

The package could be installed with Composer:

composer require yiisoft/log-target-syslog

General usage

Creating a target:

useYiisoft\Log\Target\Syslog\SyslogTarget;
$syslogTarget = newSyslogTarget($identity, $options, $facility, $levels);
  • $identity (string) - The openlog() identity.
  • $options (int) - The openlog() options. Defaults to LOG_ODELAY | LOG_PID.
  • $facility (int) - The openlog() facility. Defaults to LOG_USER.
  • $levels (array) - The log message levels that this target is interested in. Defaults to [] (all levels).

For example, to log only errors and warnings:

$syslogTarget = newSyslogTarget(
'app',
LOG_ODELAY | LOG_PID,
LOG_USER,
[LogLevel::ERROR, LogLevel::WARNING]
);

For more information about $identity, $options, and $facility, see the description of the openlog() function.

Creating a logger:

$logger = new \Yiisoft\Log\Logger([$syslogTarget]);

For use in the Yii framework, see the configuration files:

Documentation

For a description of using the logger, see the yiisoft/log package.

If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.

License

The Yii Logging Library - Syslog Target is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official websiteTwitterTelegramFacebookSlack

About

Yii Logging Library - Syslog Target

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

10 stars

Watchers

12 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages