PHP code example of mrmmg / laravel_loggify

1. Go to this page and download the library: Download mrmmg/laravel_loggify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrmmg / laravel_loggify example snippets


'database' => [
        'redis' => [
            'client' => env('REDIS_CLIENT', 'phpredis'),

            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'username' => env('REDIS_USERNAME'),
            'password' => env('REDIS_PASSWORD'),
            'port' => env('REDIS_PORT', '6379'),
            'database' => '10',
        ]
    ],

use Illuminate\Support\Facades\Log;

Log::channel('loggify')->info("Info Log Sample");

use Illuminate\Support\Facades\Log;

Log::channel('loggify')
            ->info("Info Log Sample", [
                'tags' => ['MY_CUSTOM_TAG']
            ]);

use Illuminate\Support\Facades\Log;

$user_id = \Illuminate\Support\Facades\Auth::id();
$user_type = ...;

Log::channel('loggify')
            ->info("User Logged-In", [
                'tags' => [
                    "USER_$user_id",
                    "API_VERSION_1",
                    "USER_TYPE_$user_type"
                ]
            ]);

use Illuminate\Support\Facades\Log;

Log::channel('loggify')
            ->info("Info Log Sample", [
                'tags' => ['INFO'],
                'extra' => ['Application Locale' => config('app.locale')]
            ]);

use Illuminate\Support\Facades\Log;

Log::channel('loggify')
            ->info("Info Log Sample", [
                'tags' => ['INFO'],
                'extra' => ['Application Locale' => config('app.locale')],
                'request_data' => $request->all()
            ]);

use Illuminate\Support\Facades\Log;

Log::channel('loggify')
            ->debug(...)
            
Log::channel('loggify')
            ->alert(...)

Log::channel('loggify')
            ->critical(...)

Log::channel('loggify')
            ->emergency(...)

Log::channel('loggify')
            ->error(...)

Log::channel('loggify')
            ->warning(...)

use Illuminate\Support\Facades\Log;

Log::channel('loggify')
            ->info("Info Log Sample", [
                'tags' => ['INFO'],
                'extra' => ['Application Locale' => config('app.locale')],
                'request_data' => $request->all()
            ]);

// AuthServiceProvider::class

public function boot()
    {
        // ...

        Gate::define('viewLoggify', function ($user) {
            
        });
    }
shell
php artisan loggify:install