2017 © Pedro Peláez
 

library loggy

Laravel 5 log with multiple channel

image

tolawho/loggy

Laravel 5 log with multiple channel

  • Wednesday, November 22, 2017
  • by tolawho
  • Repository
  • 2 Watchers
  • 24 Stars
  • 5,696 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 8 Versions
  • 32 % Grown

The README.md

Supports Laravel 5 writing separate log files with multiple channel., (*1)

Latest Stable Version Total Downloads License, (*2)

Requirements

Loggy >= 1.0.0 requires Laravel 5., (*3)

Installation

Require this package with Composer, (*4)

composer require tolawho/loggy

Quick Start

Once Composer has installed or updated your packages you need to register Loggy with Laravel itself. Open up config/app.php and find the providers key, towards the end of the file, and add Tolawho\Loggy\ServiceProvider:class, to the end:, (*5)

'providers' => [
    ...
    Tolawho\Loggy\ServiceProvider::class,
],

Now find the aliases key, again towards the end of the file, and add 'Loggy' => Tolawho\Loggy\Facades\Loggy::class, to have easier access to the Loggy:, (*6)

'aliases' => [
    ... 
    'Loggy' => Tolawho\Loggy\Facades\Loggy::class,
],

Now that you have both of those lines added to config/app.php we will use Artisan to publish the new config file:, (*7)

php artisan vendor:publish --provider="Tolawho\Loggy\ServiceProvider"

The example config:, (*8)

<?php

    return [
        'channels' => [
            'event' => [
                'log' => 'event.log',
                'daily' => false,
                'level' => 'debug'
            ],
            'payment' => [
                'log' => 'payment.log',
                'daily' => true,
                'level' => 'info'
            ],
        ]
    ];

Explain:, (*9)

  • channels.event: The event is name of channel do you want. Ex payment, audit
  • channels.event.log: The name of log file.
  • channels.event.daily: True if you want write log file daily like as event-2017-03-31.log.
  • channels.event.level: debug, info, notice, warning, error,critical,alert,emergency

At this point you can now begin using Loggy, (*10)

<?php

namespace App\Http\Controllers;

use Loggy; 

class HomeController extends Controller
{

    public function index()
    {
        Loggy::write('event', 'Ah hihi đồ ngốc');
        Loggy::debug('event', 'Ah hihi đồ ngốc');
        Loggy::info('event', 'Ah hihi đồ ngốc');

        return view('welcome');
    }
}

Configuration

Once Composer has installed or updated your packages you need to register Loggy with Laravel itself. Open up config/app.php and find the providers key towards the bottom and add:, (*11)

Tolawho\Loggy\ServiceProvider::class,

You can add the Loggy Facade, to have easier access to the Loggy., (*12)

'Loggy' => Tolawho\Loggy\Facades\Loggy::class

You can find the default configuration file at vendor/tolawho/loggy/src/config.php., (*13)

You should use Artisan to copy the default configuration file from the /vendor directory to /config/loggy.php with the following command:, (*14)

php artisan vendor:publish --provider="Tolawho\Loggy\ServiceProvider"

Usage

You call the Loggy like you would:, (*15)

Loggy::write('payment', 'Somthing 1...', ['something 1']);
Loggy::info('payment', 'Somthing 2..', ['something 2']);

The Versions

22/11 2017

dev-develop

dev-develop

Laravel 5 log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

22/11 2017

dev-master

9999999-dev

Laravel 5 log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

22/11 2017

v1.0.5

1.0.5.0

Laravel 5 log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

22/11 2017

v1.0.4

1.0.4.0

Laravel 5 log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

21/04 2017

v1.0.3

1.0.3.0

Laravel log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

03/04 2017

v1.0.2

1.0.2.0

Laravel log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

31/03 2017

v1.0.1

1.0.1.0

Laravel log with multiple channel

  Sources   Download

MIT

by Avatar tolawho

31/03 2017

1.0.0

1.0.0.0

Laravel log with multiple channel

  Sources   Download

MIT

by Avatar tolawho