ehough / epilog
Fork of seldaek/monolog compatible with PHP 5.2+
Installs: 5 396
Dependents: 2
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 1 637
Open Issues: 0
Requires
- php: >=5.2.0
Requires (Dev)
- aws/aws-sdk-php: ~2.4, >2.4.8
- doctrine/couchdb: ~1.0@dev
- ehough/pulsar: ~2.3
- graylog2/gelf-php: ~1.0
- phpunit/phpunit: ~3.7.0
- raven/raven: ~0.5
- ruflin/elastica: 0.90.*
Suggests
- ext-amqp: Allow sending log messages to an AMQP server (1.0+ required)
- ext-mongo: Allow sending log messages to a MongoDB server
- aws/aws-sdk-php: Allow sending log messages to AWS services like DynamoDB
- doctrine/couchdb: Allow sending log messages to a CouchDB server
- graylog2/gelf-php: Allow sending log messages to a GrayLog2 server
- raven/raven: Allow sending log messages to a Sentry server
- rollbar/rollbar: Allow sending log messages to Rollbar
- ruflin/elastica: Allow sending log messages to an Elastic Search server
This package is not auto-updated.
Last update: 2020-04-03 16:14:06 UTC
README
This library is no longer maintained. Fork of monolog compatible with PHP 5.2+.
Motivation
monolog is a fantastic logging library, but it's only compatible with PHP 5.3+. While 97% of PHP servers run PHP 5.2 or higher, 32% of all servers are still running PHP 5.2 or lower (source). It would be a shame to exempt this library from nearly a third of the world's servers just because of a few version incompatibilities.
Once PHP 5.3+ adoption levels near closer to 100%, this library will be retired.
How to use
<?php // create a log channel $log = new ehough_epilog_Logger('name'); $log->pushHandler(new ehough_epilog_handler_StreamHandler('path/to/your.log', ehough_epilog_Logger::WARNING)); // add records to the log $log->addWarning('Foo'); $log->addError('Bar');
Differences from monolog
The primary difference is naming conventions of monolog's classes. Instead of the \Monolog
namespace
(and sub-namespaces), instead prefix the class names with ehough_epilog
and follow the PEAR
naming convention.
A few examples of class naming conversions:
\Monolog\Logger -----> ehough_epilog_Logger
\Monolog\Handler\StreamHandler -----> ehough_epilog_handler_StreamHandler
\Monolog\Processor\MemoryProcessor -----> ehough_epilog_processor_MemoryProcessor
Other "gotchas" when using epilog instead of monolog:
- The Gelf handler can only be used with PHP 5.3+
- The DoctrineCouchDBHandler can only be used with PHP 5.3+
- The RedisHandler can only be used with PHP 5.3+
LoggerFactory
epilog also adds a handy class for building ehough_epilog_Logger
instances: ehough_epilog_LoggerFactory
. You can use this factory to perform one-liner instantiations:
<?php $logger = ehough_epilog_LoggerFactory::getLogger('name');
Any loggers built this way will share the same stack of handlers and processors, thereby reducing unnecessary memory overhead.
Releases and Versioning
Releases are synchronized with the upstream monolog repository. e.g. ehough/epilog 1.6.0
has merged the code
from Seldaek/monolog 1.6.0
.