Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zend Log Laravel Package

zendframework/zend-log

Zend Log is a PHP logging component for writing messages to multiple backends (files, syslog, databases, email) with flexible formatting, filters, and priorities. Part of Zend Framework, it helps you capture, route, and manage application logs reliably.

View on GitHub
Deep Wiki
Context7

PSR-3 Logger Interface compatibility

PSR-3 Logger Interface is a standards recommendation defining a common interface for logging libraries. The zend-log component predates it, and has minor incompatibilities, but starting with version 2.6 provides the following compatibility features:

  • PSR logger adapter
  • PSR logger writer
  • PSR placeholder processor

PsrLoggerAdapter

Zend\Log\PsrLoggerAdapter wraps Zend\Log\LoggerInterface, allowing it to be used anywhere Psr\Log\LoggerInterface is expected.

$zendLogLogger = new Zend\Log\Logger;

$psrLogger = new Zend\Log\PsrLoggerAdapter($zendLogLogger);
$psrLogger->log(Psr\Log\LogLevel::INFO, 'We have a PSR-compatible logger');

PSR-3 log writer

Zend\Log\Writer\Psr allows log messages and extras to be forwared to any PSR-3 compatible logger. As with any log writer, this has the added benefit that your filters can be used to limit forwarded messages.

The writer needs a Psr\Logger\LoggerInterface instance to be useful, and falls back to Psr\Log\NullLogger if none is provided. There are three ways to provide the PSR logger instance to the log writer:

// Via constructor parameter:
$writer = new Zend\Log\Writer\Psr($psrLogger);

// Via option:
$writer = new Zend\Log\Writer\Psr(['logger' => $psrLogger]);

// Via setter injection:
$writer = new Zend\Log\Writer\Psr();
$writer->setLogger($psrLogger);

PSR-3 placeholder processor

Zend\Log\Processor\PsrPlaceholder adds support for PSR-3 message placeholders. Placeholder names correspond to keys in the "extra" array passed when logging a message.

Values can be of arbitrary type, including all scalars, and objects implementing __toString; objects not capable of string serialization will result in the fully-qualified class name being substituted.

$logger = new Zend\Log\Logger;
$logger->addProcessor(new Zend\Log\Processor\PsrPlaceholder);

$logger->info('User with email {email} registered', ['email' => 'user@example.org']);
// logs message 'User with email user@example.org registered'

Usage with zend-servicemanager

For usage with zend-servicemanager, read the PsrLoggerAbstractServiceFactory documentation.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport