Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Latest commit

 

History

History
93 lines (66 loc) · 1.96 KB

README.md

File metadata and controls

93 lines (66 loc) · 1.96 KB

Laravel Multilog

Build Status Latest Stable Version License

Easily add multiple monolog channels to your Laravel 5.2.* application.

Install

Via Composer

$ composer require karlomikus/multilog

Or add the package to your composer file:

"karlomikus/multilog": "1.*"

Next register service provider and facade in your config/app.php file:

// Service provider
Karlomikus\Multilog\MultilogServiceProvider::class
// Facade (optional)
'Multilog' => Karlomikus\Multilog\Facade::class

And finally publish the config file:

$ php artisan vendor:publish

Configuration

All your channels are defined in config/multilog.php file.

By default you have two channels (request and info):

// Request channel
'request' => [
    'stream' => 'request.log',
    'daily'  => true,
    'format' => [
        'date'   => 'Y-m-d H:i:s',
        'output' => "[%datetime%] %message% %context% %extra%\n",
    ],
],
// Info channel
'info' => [
    'stream' => 'info.log',
    'daily'  => false
]

Usage

Using dependency injection:

use Karlomikus\Multilog\Contracts\MultilogInterface;

private $multilog;

public function __construct(MultilogInterface $multilog)
{
    $this->multilog = $multilog;

    $this->multilog->channel('request')->error('Error here...');
}

Using facade:

Multilog::channel('channel-name')->info('Information here...');

// Channel shorthand is also available
Multilog::c('channel-name')->warning('Warning here...');

Change log

[1.0.0] - 2016-03-06

  • Initial release

License

The MIT License (MIT). Please see License File for more information.