Releases: Erebot/Plop
0.5.0
Changes
- Dropped support for PHP 5.2.x. PHP 5.3.3 is now the minimal required version.
- Removed support for per-file loggers. Use per-namespace loggers instead.
- Reworked some of the APIs related to object collections.
- The project's documentation is now available for online reading and downloading at http://plop.readthedocs.org/en/latest/
New features
- Added full support for PHP namespaces. In particular, it is now possible to retrieve a logger based on namespaces. See the documentation for more information and code examples.
- Added support for the PSR3
Psr\Log\LoggerInterface
interface (http://www.php-fig.org/psr/psr-3/ / https://github.com/php-fig/log/tree/master/Psr/Log) using the\Plop\Psr3Logger
class. - Added "interpolators" which can be used to substitute variables with their actual value (aka. interpolation). See below for more information.
Interpolators
There are currently 2 interpolators available :
\Plop\Interpolator\Percent
which implements the old interpolation mechanism (based on the old Python string formatting syntax)\Plop\Interpolator\Psr3
which implements PSR3 interpolation (using curly braces delimiters).
Two interpolators are used during formatting :
- one for the log message (injecting developer-supplied arguments into the message)
- another one for the overall log output (injecting environment-supplied values like current time, filename/namespace/class/function where the log was created, etc.).
You can specify the log message interpolator when creating a new log record (either directly with \Plop\Record
or through a record factory like \Plop\RecordFactory
). You may change the interpolator used later on by using the record's setInterpolator()
method.
Please note however that this usually does not make sense unless a log record's message is dynamically modified and requires another type of interpolation in order to be processed correctly.
See also the API for \Plop\RecordInterface
for more information.
The overall interpolator can be set during creation of \Plop\Formatter
instances. It can be changed later on by calling the formatter's setInterpolator()
method.
See also the API for \Plop\FormatterInterface
for more information.