astrotomic/laravel-monolog-config

Simple Configuration Package for Monolog in Laravel.

1.4.0 2017-05-11 11:45 UTC

README

GitHub Author GitHub release GitHub license GitHub issues

StyleCI Code Climate Code Climate

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