1# Monolog - Logging for PHP [![Continuous Integration](https://github.com/Seldaek/monolog/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/Seldaek/monolog/actions) 2 3[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) 4[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) 5 6 7Monolog sends your logs to files, sockets, inboxes, databases and various 8web services. See the complete list of handlers below. Special handlers 9allow you to build advanced logging strategies. 10 11This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 12interface that you can type-hint against in your own libraries to keep 13a maximum of interoperability. You can also use it in your applications to 14make sure you can always use another compatible logger at a later time. 15As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. 16Internally Monolog still uses its own level scheme since it predates PSR-3. 17 18## Installation 19 20Install the latest version with 21 22```bash 23$ composer require monolog/monolog 24``` 25 26## Basic Usage 27 28```php 29<?php 30 31use Monolog\Logger; 32use Monolog\Handler\StreamHandler; 33 34// create a log channel 35$log = new Logger('name'); 36$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); 37 38// add records to the log 39$log->warning('Foo'); 40$log->error('Bar'); 41``` 42 43## Documentation 44 45- [Usage Instructions](doc/01-usage.md) 46- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) 47- [Utility Classes](doc/03-utilities.md) 48- [Extending Monolog](doc/04-extending.md) 49- [Log Record Structure](doc/message-structure.md) 50 51## Support Monolog Financially 52 53Get supported Monolog and help fund the project with the [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-monolog-monolog?utm_source=packagist-monolog-monolog&utm_medium=referral&utm_campaign=enterprise) or via [GitHub sponsorship](https://github.com/sponsors/Seldaek). 54 55Tidelift delivers commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. 56 57## Third Party Packages 58 59Third party handlers, formatters and processors are 60[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You 61can also add your own there if you publish one. 62 63## About 64 65### Requirements 66 67- Monolog `^2.0` works with PHP 7.2 or above, use Monolog `^1.25` for PHP 5.3+ support. 68 69### Support 70 71Monolog 1.x support is somewhat limited at this point and only important fixes will be done. You should migrate to Monolog 2 where possible to benefit from all the latest features and fixes. 72 73### Submitting bugs and feature requests 74 75Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) 76 77### Framework Integrations 78 79- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 80 can be used very easily with Monolog since it implements the interface. 81- [Symfony](http://symfony.com) comes out of the box with Monolog. 82- [Laravel](http://laravel.com/) comes out of the box with Monolog. 83- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. 84- [PPI](https://github.com/ppi/framework) comes out of the box with Monolog. 85- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. 86- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. 87- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. 88- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. 89- [Nette Framework](http://nette.org/en/) is usable with Monolog via the [contributte/monolog](https://github.com/contributte/monolog) or [orisai/nette-monolog](https://github.com/orisai/nette-monolog) extensions. 90- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. 91- [FuelPHP](http://fuelphp.com/) comes out of the box with Monolog. 92- [Equip Framework](https://github.com/equip/framework) comes out of the box with Monolog. 93- [Yii 2](http://www.yiiframework.com/) is usable with Monolog via the [yii2-monolog](https://github.com/merorafael/yii2-monolog) or [yii2-psr-log-target](https://github.com/samdark/yii2-psr-log-target) plugins. 94- [Hawkbit Micro Framework](https://github.com/HawkBitPhp/hawkbit) comes out of the box with Monolog. 95- [SilverStripe 4](https://www.silverstripe.org/) comes out of the box with Monolog. 96- [Drupal](https://www.drupal.org/) is usable with Monolog via the [monolog](https://www.drupal.org/project/monolog) module. 97- [Aimeos ecommerce framework](https://aimeos.org/) is usable with Monolog via the [ai-monolog](https://github.com/aimeos/ai-monolog) extension. 98- [Magento](https://magento.com/) comes out of the box with Monolog. 99 100### Author 101 102Jordi Boggiano - <j.boggiano@seld.be> - <http://twitter.com/seldaek><br /> 103See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) who participated in this project. 104 105### License 106 107Monolog is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 108 109### Acknowledgements 110 111This library is heavily inspired by Python's [Logbook](https://logbook.readthedocs.io/en/stable/) 112library, although most concepts have been adjusted to fit to the PHP world. 113