2015-06-19 15:06:20 +01:00
|
|
|
# Monolog - Logging for PHP [](https://travis-ci.org/Seldaek/monolog)
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2015-06-19 15:06:20 +01:00
|
|
|
[](https://packagist.org/packages/monolog/monolog)
|
|
|
|
[](https://packagist.org/packages/monolog/monolog)
|
2014-07-26 11:14:30 +02:00
|
|
|
[](https://www.versioneye.com/php/monolog:monolog/references)
|
2013-06-19 12:18:02 +02:00
|
|
|
|
|
|
|
|
2013-01-07 21:23:22 +01:00
|
|
|
Monolog sends your logs to files, sockets, inboxes, databases and various
|
|
|
|
web services. See the complete list of handlers below. Special handlers
|
|
|
|
allow you to build advanced logging strategies.
|
|
|
|
|
|
|
|
This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
|
|
|
|
interface that you can type-hint against in your own libraries to keep
|
2013-01-07 21:26:46 +01:00
|
|
|
a maximum of interoperability. You can also use it in your applications to
|
|
|
|
make sure you can always use another compatible logger at a later time.
|
2014-09-30 13:59:45 +01:00
|
|
|
As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
|
|
|
|
Internally Monolog still uses its own level scheme since it predates PSR-3.
|
2011-11-13 00:39:39 +00:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
## Installation
|
2015-05-27 17:21:14 +02:00
|
|
|
|
|
|
|
Install the latest version with
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ composer require monolog/monolog
|
|
|
|
```
|
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
## Basic Usage
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2012-04-26 07:22:34 -07:00
|
|
|
```php
|
|
|
|
<?php
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2012-04-26 07:22:34 -07:00
|
|
|
use Monolog\Logger;
|
|
|
|
use Monolog\Handler\StreamHandler;
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2012-04-26 07:22:34 -07:00
|
|
|
// create a log channel
|
|
|
|
$log = new Logger('name');
|
|
|
|
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
|
|
|
|
|
|
|
|
// add records to the log
|
|
|
|
$log->addWarning('Foo');
|
|
|
|
$log->addError('Bar');
|
|
|
|
```
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
## Documentation
|
2011-02-21 19:59:48 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
- [Usage Instructions](doc/01-usage.md)
|
|
|
|
- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md)
|
|
|
|
- [Utility classes](doc/03-utilities.md)
|
|
|
|
- [Extending Monolog](doc/04-extending.md)
|
2012-04-22 18:04:40 +02:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
## Third Party Packages
|
2015-01-07 12:49:55 +00:00
|
|
|
|
|
|
|
Third party handlers, formatters and processors are
|
|
|
|
[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
|
|
|
|
can also add your own there if you publish one.
|
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
## About
|
2011-05-09 14:57:05 +02:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### Requirements
|
2011-02-21 19:59:48 +01:00
|
|
|
|
2014-04-04 17:22:02 +02:00
|
|
|
- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM.
|
2011-02-21 19:59:48 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### Submitting bugs and feature requests
|
2011-05-08 18:26:39 +02:00
|
|
|
|
2011-09-17 11:43:09 +02:00
|
|
|
Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
|
2011-05-08 18:26:39 +02:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### Framework Integrations
|
2013-02-13 18:56:49 +01:00
|
|
|
|
|
|
|
- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
|
|
|
|
can be used very easily with Monolog since it implements the interface.
|
|
|
|
- [Symfony2](http://symfony.com) comes out of the box with Monolog.
|
|
|
|
- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog.
|
2015-02-05 11:06:13 +01:00
|
|
|
- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog.
|
2015-04-16 16:08:16 +02:00
|
|
|
- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog.
|
2013-02-13 18:56:49 +01:00
|
|
|
- [PPI](http://www.ppi.io/) comes out of the box with Monolog.
|
|
|
|
- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin.
|
2013-04-05 16:36:57 +03:00
|
|
|
- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer.
|
2013-09-16 11:22:24 +02:00
|
|
|
- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog.
|
2013-12-12 11:38:58 -06:00
|
|
|
- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog.
|
2015-01-29 15:56:43 +01:00
|
|
|
- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension.
|
2015-06-19 14:57:05 +01:00
|
|
|
- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog.
|
2013-02-13 18:56:49 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### Author
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2011-03-27 06:23:03 -07:00
|
|
|
Jordi Boggiano - <j.boggiano@seld.be> - <http://twitter.com/seldaek><br />
|
2011-03-27 06:22:19 -07:00
|
|
|
See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project.
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### License
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2012-04-27 08:39:21 -07:00
|
|
|
Monolog is licensed under the MIT License - see the `LICENSE` file for details
|
2011-02-17 03:04:58 +01:00
|
|
|
|
2015-06-19 14:57:05 +01:00
|
|
|
### Acknowledgements
|
2011-02-20 20:52:52 +01:00
|
|
|
|
2012-04-22 18:04:40 +02:00
|
|
|
This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/)
|
|
|
|
library, although most concepts have been adjusted to fit to the PHP world.
|