PHP code example of cloudmyn / logger

1. Go to this page and download the library: Download cloudmyn/logger 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/ */

    

cloudmyn / logger example snippets




namespace App\Exceptions;

use CloudMyn\Logger\Facade\Logger;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{

  // ...

    /**
     * Report or log an exception.
     *
     * @param  \Throwable  $throwable
     * @return void
     *
     * @throws \Throwable
     */
    public function report(Throwable $throwable)
    {
        Logger::log($throwable, auth()->user());
        
        parent::report($throwable); // you can removed this if you want
    }
  
  // ...

}



use CloudMyn\Logger\Facade\Logger;

// Method for log an exception or error
Logger::log($throwable);

// Method for get the log files
Logger::getLogFiles();

// Method for find a log base on the given id
Logger::findById($log_filename, $id);

// Method for get the error log by id
Logger::whereId($log_filename, $id, $ignore_trace_and_prev);

// Method for get the error log by class
Logger::whereClass($log_filename, $class, $ignore_trace_and_prev);

// Method for get the error log by Message
Logger::whereMessage($log_filename, $message, $ignore_trace_and_prev);

// Method for get the error log by IP
Logger::whereIp($log_filename, $ip, $ignore_trace_and_prev);

// Method for get the error log by User Id
Logger::whereUserId($log_filename, $user_id, $ignore_trace_and_prev);

// Method for get the error log by Filename
Logger::whereFilename($log_filename, $filename, $ignore_trace_and_prev);

// Method for delete log file
Logger::delete($filename)