astrotomic / laravel-monolog-config
Simple Configuration Package for Monolog in Laravel.
Installs: 33 585
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 8
Open Issues: 2
Requires
- php: >=5.5.0
- illuminate/support: ~5.0
- monolog/monolog: ^1.21
Requires (Dev)
- ext-mongodb: *
- graylog2/gelf-php: ^1.5
- laravel/framework: ~5.0
- mongodb/mongodb: ^1.1
- predis/predis: ^1.1
Suggests
- 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
- mongodb/mongodb: Allow sending log messages to a MongoDB server via PHP Driver
- php-amqplib/php-amqplib: Allow sending log messages to an AMQP server using php-amqplib
- php-console/php-console: Allow sending log messages to Google Chrome
- predis/predis: Allow sending log messages to Redis
- rollbar/rollbar: Allow sending log messages to Rollbar
- ruflin/elastica: Allow sending log messages to an Elastic Search server
- sentry/sentry: Allow sending log messages to a Sentry server
This package is not auto-updated.
Last update: 2019-10-22 12:08:37 UTC
README
This package provides a simple way to configure monolog in Laravel/Lumen.
Installation
Step 1
Add it on your composer.json
"astrotomic/laravel-monolog-config": "^1.0"
and run
composer update
or run
composer require astrotomic/laravel-monolog-config
Step 2
Add the following string to config/app.php
Providers array:
\Astrotomic\MonologConfig\MonologConfigServiceProvider::class,
Step 3
Publish the configuration for monolog with the following command:
php artisan vendor:publish --provider="Astrotomic\MonologConfig\MonologConfigServiceProvider"
And adjust all the configurations to your needs.
Step 4
Use it as your monolog configuration tool. Add this to your bootstrap/app.php
after the Interface bindings and before the return:
/* |-------------------------------------------------------------------------- | Configure Monolog |-------------------------------------------------------------------------- */ $app->configureMonologUsing(function (Monolog\Logger $monolog) { $configurator = new \Astrotomic\MonologConfig\MonologConfigurator($monolog); $configurator->run(); });
You can configure monolog after this your own in this method the normal Laravel way.
Handlers
At the moment this class supports the following handlers, if you need any other one just create a PR or write an issue.
v1.0.0
\Monolog\Handler\ErrorLogHandler
\Monolog\Handler\GelfHandler
\Monolog\Handler\LogglyHandler
\Monolog\Handler\MandrillHandler
\Monolog\Handler\MongoDBHandler
\Monolog\Handler\NativeMailerHandler
\Monolog\Handler\RotatingFileHandler
\Monolog\Handler\StreamHandler
\Monolog\Handler\SyslogHandler
v1.1.0
\Monolog\Handler\HipChatHandler
\Monolog\Handler\IFTTTHandler
\Monolog\Handler\LogEntriesHandler
\Monolog\Handler\NullHandler
\Monolog\Handler\RedisHandler
\Monolog\Handler\ZendMonitorHandler
v1.3.0
\Monolog\Handler\SlackHandler
\Monolog\Handler\SlackWebhookHandler
\Monolog\Handler\SlackbotHandler