Skip to content

Releases: Seldaek/monolog

3.0.0-RC1

08 May 22:12
a71c4e0
Compare
Choose a tag to compare
3.0.0-RC1 Pre-release
Pre-release

This is mostly a cleanup release offering stronger type guarantees for integrators with the
array->object/enum changes, but there is no big new feature for end users.

See UPGRADE notes for details on all breaking changes especially if you are extending/implementing Monolog classes/interfaces.

Noteworthy BC Breaks:

  • The minimum supported PHP version is now 8.1.0.
  • Log records have been converted from an array to a Monolog\LogRecord object
    with public (and mostly readonly) properties. e.g. instead of doing
    $record['context'] use $record->context.
    In formatters or handlers if you rather need an array to work with you can use $record->toArray()
    to get back a Monolog 1/2 style record array. This will contain the enum values instead of enum cases
    in the level and level_name keys to be more backwards compatible and use simpler data types.
  • FormatterInterface, HandlerInterface, ProcessorInterface, etc. changed to contain LogRecord $record
    instead of array $record parameter types. If you want to support multiple Monolog versions this should
    be possible by type-hinting nothing, or array|LogRecord if you support PHP 8.0+. You can then code
    against the $record using Monolog 2 style as LogRecord implements ArrayAccess for BC.
    The interfaces do not require a LogRecord return type even where it would be applicable, but if you only
    support Monolog 3 in integration code I would recommend you use LogRecord return types wherever fitting
    to ensure forward compatibility as it may be added in Monolog 4.
  • Log levels are now enums Monolog\Level and Monolog\LevelName
  • Removed deprecated SwiftMailerHandler, migrate to SymfonyMailerHandler instead.
  • ResettableInterface::reset() now requires a void return type.
  • All properties have had types added, which may require you to do so as well if you extended
    a Monolog class and declared the same property.

New deprecations:

  • Logger::DEBUG, Logger::ERROR, etc. are now deprecated in favor of the Monolog\Level enum.
    e.g. instead of Logger::WARNING use Level::Warning if you need to pass the enum case
    to Monolog or one of its handlers, or Level::Warning->value if you need the integer
    value equal to what Logger::WARNING was giving you.
  • Logger::getLevelName() is now deprecated.

2.5.0

08 Apr 15:44
4192345
Compare
Choose a tag to compare
  • Added callType to IntrospectionProcessor (#1612)
  • Fixed AsMonologProcessor syntax to be compatible with PHP 7.2 (#1651)

Full Changelog: 2.4.0...2.5.0

2.4.0

14 Mar 12:45
d7fd745
Compare
Choose a tag to compare
  • Added Monolog\LogRecord interface that can be used to type-hint records like array|\Monolog\LogRecord $record to be forward compatible with the upcoming Monolog 3 changes
  • Added includeStacktraces constructor params to LineFormatter & JsonFormatter (#1603)
  • Added persistent, timeout, writingTimeout, connectionTimeout, chunkSize constructor params to SocketHandler and derivatives (#1600)
  • Added AsMonologProcessor PHP attribute which can help autowiring / autoconfiguration of processors if frameworks / integrations decide to make use of it. This is useless when used purely with Monolog (#1637)
  • Added support for keeping native BSON types as is in MongoDBFormatter (#1620)
  • Added support for a user_agent key in WebProcessor, disabled by default but you can use it by configuring the $extraFields you want (#1613)
  • Added support for username/userIcon in SlackWebhookHandler (#1617)
  • Added extension points to BrowserConsoleHandler (#1593)
  • Added record message/context/extra info to exceptions thrown when a StreamHandler cannot open its stream to avoid completely losing the data logged (#1630)
  • Fixed error handler signature to accept a null $context which happens with internal PHP errors (#1614)
  • Fixed a few setter methods not returning self (#1609)
  • Fixed handling of records going over the max Telegram message length (#1616)

1.27.0

13 Mar 20:35
52ebd23
Compare
Choose a tag to compare
  • Added $maxDepth / setMaxDepth to NormalizerFormatter / JsonFormatter to configure the maximum depth if the default of 9 does not work for you (#1633)

2.3.5

01 Oct 21:08
fd4380d
Compare
Choose a tag to compare
  • Fixed regression in StreamHandler since 2.3.3 on systems with the memory_limit set to >=20GB (#1592)

2.3.4

15 Sep 11:30
437e7a1
Compare
Choose a tag to compare
  • Fixed support for psr/log 3.x (#1589)

2.3.3

14 Sep 18:41
3962ebf
Compare
Choose a tag to compare
  • Fixed memory usage when using StreamHandler and calling stream_get_contents on the resource you passed to it (#1578, #1577)
  • Fixed support for psr/log 2.x (#1587)
  • Fixed some type annotations

2.3.2

23 Jul 07:43
7131256
Compare
Choose a tag to compare
  • Fixed compatibility with PHP 7.2 - 7.4 when experiencing PCRE errors (#1568)

2.3.1

14 Jul 11:56
9738e49
Compare
Choose a tag to compare
  • Fixed Utils::getClass handling of anonymous classes not being fully compatible with PHP 8 (#1563)
  • Fixed some @inheritDoc annotations having the wrong case

2.3.0

05 Jul 11:35
df991fd
Compare
Choose a tag to compare
  • Added a ton of PHPStan type annotations as well as type aliases on Monolog\Logger for Record, Level and LevelName that you can import (#1557)
  • Added ability to customize date format when using JsonFormatter (#1561)
  • Fixed FilterHandler not calling reset on its internal handler when reset() is called on it (#1531)
  • Fixed SyslogUdpHandler not setting the timezone correctly on DateTimeImmutable instances (#1540)
  • Fixed StreamHandler thread safety - chunk size set to 2GB now to avoid interlacing when doing concurrent writes (#1553)